hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stack (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HBASE-1107) NPE in HStoreScanner.updateReaders
Date Mon, 05 Jan 2009 20:23:44 GMT

    [ https://issues.apache.org/jira/browse/HBASE-1107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660902#action_12660902
] 

stack commented on HBASE-1107:
------------------------------

I think this NPE is a symptom of our making the list of changed readers observers sloppier
using CopyOnWrite.  I think the scanner has been closed.  The first thing done on close is
that we remove ourselves from the list of changed readers observers but my guess is that there
is an outstanding iteration going on.  It still has a reference and invoked the observer code
AFTER the clearing of the memcache scanner.

I'm not sure your attached patch safe enough Andrew.  My worry is that between your new check
on #320, this.keys[MEMS_INDEX] could be cleared before its use on #327 by another thread.
 What you think?

The observer code -- updateReaders method -- shouldn't run if close has been invoked methinks.
 I was going to add in a 'close' flag.  Seems like overkill but ain't sure what else to use
as 'close' indicator:

{code}
Index: src/java/org/apache/hadoop/hbase/regionserver/HStoreScanner.java
===================================================================
--- src/java/org/apache/hadoop/hbase/regionserver/HStoreScanner.java    (revision 731185)
+++ src/java/org/apache/hadoop/hbase/regionserver/HStoreScanner.java    (working copy)
@@ -26,6 +26,7 @@
 import java.util.Set;
 import java.util.SortedMap;
 import java.util.TreeMap;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.apache.commons.logging.Log;
@@ -60,6 +61,8 @@
   // Used around transition from no storefile to the first.
   private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
   
+  private final AtomicBoolean closing = new AtomicBoolean(false);
+  
   /** Create an Scanner with a handle on the memcache and HStore files. */
   @SuppressWarnings("unchecked")
   HStoreScanner(HStore store, byte [][] targetCols, byte [] firstRow,
@@ -294,6 +297,7 @@
   }
 
   public void close() {
+    this.closing.set(true);
     this.store.deleteChangedReaderObserver(this);
     doClose();
   }
@@ -309,6 +313,9 @@
   // Implementation of ChangedReadersObserver
   
   public void updateReaders() throws IOException {
+    if (this.closing.get()) {
+      return;
+    }
     this.lock.writeLock().lock();
     try {
       MapFile.Reader [] readers = this.store.getReaders();
{code}

> NPE in HStoreScanner.updateReaders
> ----------------------------------
>
>                 Key: HBASE-1107
>                 URL: https://issues.apache.org/jira/browse/HBASE-1107
>             Project: Hadoop HBase
>          Issue Type: Bug
>            Reporter: Andrew Purtell
>            Assignee: Andrew Purtell
>            Priority: Critical
>             Fix For: 0.19.0
>
>         Attachments: 1107-1.patch
>
>
> 2009-01-01 23:55:41,629 FATAL org.apache.hadoop.hbase.regionserver.MemcacheFlusher: Replay
of hlog required. Forcing server shutdown
> org.apache.hadoop.hbase.DroppedSnapshotException: region: content,cff13605e2ea6ce0b221ac864687bf08,1230777531253
>         at org.apache.hadoop.hbase.regionserver.HRegion.internalFlushcache(HRegion.java:880)
>         at org.apache.hadoop.hbase.regionserver.HRegion.flushcache(HRegion.java:773)
>         at org.apache.hadoop.hbase.regionserver.MemcacheFlusher.flushRegion(MemcacheFlusher.java:227)
>         at org.apache.hadoop.hbase.regionserver.MemcacheFlusher.run(MemcacheFlusher.java:137)
> Caused by: java.lang.NullPointerException
>         at org.apache.hadoop.hbase.regionserver.HStoreScanner.updateReaders(HStoreScanner.java:322)
>         at org.apache.hadoop.hbase.regionserver.HStore.notifyChangedReadersObservers(HStore.java:737)
>         at org.apache.hadoop.hbase.regionserver.HStore.updateReaders(HStore.java:725)
>         at org.apache.hadoop.hbase.regionserver.HStore.internalFlushCache(HStore.java:694)
>         at org.apache.hadoop.hbase.regionserver.HStore.flushCache(HStore.java:630)
>         at org.apache.hadoop.hbase.regionserver.HRegion.internalFlushcache(HRegion.java:865)
>         ... 3 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message