You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bookkeeper.apache.org by "Matteo Merli (JIRA)" <ji...@apache.org> on 2013/02/13 17:44:13 UTC

[jira] [Updated] (BOOKKEEPER-568) NPE during GC with HierarchicalLedgerManager

     [ https://issues.apache.org/jira/browse/BOOKKEEPER-568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matteo Merli updated BOOKKEEPER-568:
------------------------------------

    Attachment: 0001-BOOKKEEPER-568-NPE-during-GC-with-HierarchicalLedger.patch

Here's the patch with a very simple test case that would throw exception without the fix
                
> NPE during GC with HierarchicalLedgerManager
> --------------------------------------------
>
>                 Key: BOOKKEEPER-568
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-568
>             Project: Bookkeeper
>          Issue Type: Bug
>          Components: bookkeeper-server
>    Affects Versions: 4.2.0
>            Reporter: Matteo Merli
>            Priority: Minor
>         Attachments: 0001-BOOKKEEPER-568-NPE-during-GC-with-HierarchicalLedger.patch
>
>
> {noformat}
> 2013-02-11 14:06:28,904 - WARN  - [GarbageCollectorThread:ScanAndCompareGarbageCollector@103] - Exception when iterating over the metadata {}
> java.io.IOException: Error when check more elements
> 	at org.apache.bookkeeper.meta.HierarchicalLedgerManager$HierarchicalLedgerRangeIterator.hasNext(HierarchicalLedgerManager.java:423)
> 	at org.apache.bookkeeper.bookie.ScanAndCompareGarbageCollector.gc(ScanAndCompareGarbageCollector.java:75)
> 	at org.apache.bookkeeper.bookie.GarbageCollectorThread.doGcLedgers(GarbageCollectorThread.java:302)
> 	at org.apache.bookkeeper.bookie.GarbageCollectorThread.run(GarbageCollectorThread.java:271)
> Caused by: java.lang.NullPointerException
> 	at org.apache.bookkeeper.meta.HierarchicalLedgerManager$HierarchicalLedgerRangeIterator.hasNext(HierarchicalLedgerManager.java:419)
> 	... 3 more
> {noformat}
> In the code below, l2NodesIter appears to be null.
> {code}
> public boolean hasNext() throws IOException {
>    try {
>       if (l1NodesIter == null) {
>           l1NodesIter = zk.getChildren(ledgerRootPath, null).iterator();
>           hasMoreElement = nextL1Node();
>       } else if (!l2NodesIter.hasNext()) {
>           hasMoreElement = nextL1Node();
>       }
>    } catch (Exception e) {
>       throw new IOException("Error when check more elements", e);
>    }
>    return hasMoreElement;
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira