Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AE39F200CAE for ; Wed, 7 Jun 2017 08:22:29 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id ACE70160BD3; Wed, 7 Jun 2017 06:22:29 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F3679160BC6 for ; Wed, 7 Jun 2017 08:22:28 +0200 (CEST) Received: (qmail 16161 invoked by uid 500); 7 Jun 2017 06:22:22 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 16148 invoked by uid 99); 7 Jun 2017 06:22:22 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jun 2017 06:22:22 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 09C7B1AFE33 for ; Wed, 7 Jun 2017 06:22:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id AducVbqVUBip for ; Wed, 7 Jun 2017 06:22:21 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 4D1575FC1C for ; Wed, 7 Jun 2017 06:22:20 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 77557E00A0 for ; Wed, 7 Jun 2017 06:22:19 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 8859D21E16 for ; Wed, 7 Jun 2017 06:22:18 +0000 (UTC) Date: Wed, 7 Jun 2017 06:22:18 +0000 (UTC) From: "Chia-Ping Tsai (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-18168) NoSuchElementException when rolling the log MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 07 Jun 2017 06:22:29 -0000 [ https://issues.apache.org/jira/browse/HBASE-18168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16040280#comment-16040280 ] Chia-Ping Tsai commented on HBASE-18168: ---------------------------------------- {code} + if (m == null || m.size() == 0) { {code} The isEmpty() is more readable. > NoSuchElementException when rolling the log > ------------------------------------------- > > Key: HBASE-18168 > URL: https://issues.apache.org/jira/browse/HBASE-18168 > Project: HBase > Issue Type: Bug > Affects Versions: 1.1.11 > Reporter: Allan Yang > Assignee: Allan Yang > Attachments: HBASE-18168-branch-1.1.patch, HBASE-18168-branch-1.1.v2.patch > > > Today, one of our server aborted due to the following log. > {code} > 2017-06-06 05:38:47,142 ERROR [regionserver/xxxx.logRoller] regionserver.LogRoller: Log rolling failed > java.util.NoSuchElementException > at java.util.concurrent.ConcurrentSkipListMap$Iter.advance(ConcurrentSkipListMap.java:2224) > at java.util.concurrent.ConcurrentSkipListMap$ValueIterator.next(ConcurrentSkipListMap.java:2253) > at java.util.Collections.min(Collections.java:628) > at org.apache.hadoop.hbase.regionserver.wal.FSHLog.findEligibleMemstoresToFlush(FSHLog.java:861) > at org.apache.hadoop.hbase.regionserver.wal.FSHLog.findRegionsToForceFlush(FSHLog.java:886) > at org.apache.hadoop.hbase.regionserver.wal.FSHLog.rollWriter(FSHLog.java:728) > at org.apache.hadoop.hbase.regionserver.LogRoller.run(LogRoller.java:137) > at java.lang.Thread.run(Thread.java:756) > 2017-06-06 05:38:47,142 FATAL [regionserver/xxxx.logRoller] regionserver.HRegionServer: ABORTING region server xxxx: Log rolling failed > java.util.NoSuchElementException > ...... > {code} > The code is here: > {code} > private byte[][] findEligibleMemstoresToFlush(Map regionsSequenceNums) { > List regionsToFlush = null; > // Keeping the old behavior of iterating unflushedSeqNums under oldestSeqNumsLock. > synchronized (regionSequenceIdLock) { > for (Map.Entry e: regionsSequenceNums.entrySet()) { > ConcurrentMap m = > this.oldestUnflushedStoreSequenceIds.get(e.getKey()); > if (m == null) { > continue; > } > long unFlushedVal = Collections.min(m.values()); //The exception is thrown here > ...... > {code} > The map 'm' is empty is the only reason I can think of why NoSuchElementException is thrown. I then looked up all code related to the update of 'oldestUnflushedStoreSequenceIds'. All update to 'oldestUnflushedStoreSequenceIds' is guarded by the synchronization of 'regionSequenceIdLock' except here: > {code} > private ConcurrentMap getOrCreateOldestUnflushedStoreSequenceIdsOfRegion( > byte[] encodedRegionName) { > ...... > oldestUnflushedStoreSequenceIdsOfRegion = > new ConcurrentSkipListMap(Bytes.BYTES_COMPARATOR); > ConcurrentMap alreadyPut = > oldestUnflushedStoreSequenceIds.putIfAbsent(encodedRegionName, > oldestUnflushedStoreSequenceIdsOfRegion); // Here, a empty map may put to 'oldestUnflushedStoreSequenceIds' with no synchronization > return alreadyPut == null ? oldestUnflushedStoreSequenceIdsOfRegion : alreadyPut; > } > {code} > It should be a very rare bug. But it can lead to server abort. It only exists in branch-1.1. -- This message was sent by Atlassian JIRA (v6.3.15#6346)