You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/03/29 22:56:14 UTC

[GitHub] [accumulo] ctubbsii commented on issue #1064: Native maps crash (segfault) when calling LinkedBlockAllocator.deleteLast()

ctubbsii commented on issue #1064: Native maps crash (segfault) when calling LinkedBlockAllocator.deleteLast()
URL: https://github.com/apache/accumulo/issues/1064#issuecomment-478173489
 
 
   So, it looks like the problem is that we do not guard our vector against calls to `back()` when it is empty. When empty, `vector.back()` is undefined. Apparently, this changed in behavior between libtstdc++ 8.2 and 8.3... but it shouldn't have mattered. We should not have been trying to call `back()` when the vector was empty.
   
   Something in our code assumes that `bigBlocks` will not be empty when `LinkedBlockAllocator::deleteLast` is called, but that assumption is wrong in some circumstances. I haven't yet figured out which circumstances, but the following guard does cause the test to work:
   
   ```patch
   diff --git a/server/native/src/main/c++/nativeMap/BlockAllocator.h b/server/native/src/main/c++/nativeMap/BlockAllocator.h
   index b7eb60e22d..da8e53fa0d 100644
   --- a/server/native/src/main/c++/nativeMap/BlockAllocator.h
   +++ b/server/native/src/main/c++/nativeMap/BlockAllocator.h
   @@ -124,6 +124,8 @@ struct LinkedBlockAllocator {
            blocks.back().rollback(p);
            lastAlloc = NULL;
            return;
   +      }else if(bigBlocks.empty()){
   +        return;
          }else if(bigBlocks.back().ptr == p){
            memused -= (sizeof(BigBlock) + bigBlocks.back().length);
            bigBlocks.pop_back();
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services