facebook / facebook/rocksdb

SEGSEGV for JNI based RocksDB usage (`LoadTableHandlers` -> `__memcmp_sse4_1+0xa1e`)

Open
#9,693 0 comments 0 reactions 0 assignees View on GitHub
question segfault up-for-grabs
Dominant language
C++
Stars
32.1k
Forks
6.9k
Avg merge
32m
Merged PRs (30d)
1

Description

Ran into this SEGSEGV while testing https://github.com/facebook/rocksdb/issues/8617.
The following steps were used to test https://github.com/facebook/rocksdb/issues/8617#issuecomment-1042609708
This crash is not as easy to reproduce as #8617
```
Command Line: -Xmx2G -XX:OnError=gdb - %p /root/RocksDBCrash-1.0-SNAPSHOT-jar-with-dependencies.jar -p /data/disk1/debug/ -n 60000 -k 100000 -o 1000000 -c 800

Host: Intel(R) Xeon(R) Gold 6132 CPU @ 2.60GHz, 56 cores, 251G, Red Hat Enterprise Linux Server release 7.8 (Maipo)
Time: Tue Mar 8 09:38:55 2022 PST elapsed time: 86402.307230 seconds (1d 0h 0m 2s)

--------------- T H R E A D ---------------

Current thread is native thread

Stack: [0x00007f9a820f0000,0x00007f9a828ef000], sp=0x00007f9a828ed0d8, free space=8180k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libc.so.6+0x16a9ce] __memcmp_sse4_1+0xa1e
C [librocksdbjni4132153615819748121.so+0xe7178f] __gnu_cxx::__enable_if::__value, bool>::__type std::operator==(std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&)+0x6b
C [librocksdbjni4132153615819748121.so+0x1366ca5] rocksdb::FindOptionalMetaBlock(rocksdb::InternalIteratorBase*, std::string const&, rocksdb::BlockHandle*)+0x1ed
C [librocksdbjni4132153615819748121.so+0x1304dcf] rocksdb::BlockBasedTable::ReadPropertiesBlock(rocksdb::ReadOptions const&, rocksdb::FilePrefetchBuffer*, rocksdb::InternalIteratorBase*, unsigned long)+0x7f
C [librocksdbjni4132153615819748121.so+0x1304376] rocksdb::BlockBasedTable::Open(rocksdb::ReadOptions const&, rocksdb::ImmutableOptions const&, rocksdb::EnvOptions const&, rocksdb::BlockBasedTableOptions const&, rocksdb::InternalKeyComparator const&, std::unique_ptr >&&, unsigned long, std::unique_ptr >*, std::shared_ptr const&, bool, bool, int, bool, unsigned long, bool, rocksdb::TailPrefetchStats*, rocksdb::BlockCacheTracer*, unsigned long, std::string const&, unsigned long)+0x6b2
C [librocksdbjni4132153615819748121.so+0x12ed467] rocksdb::BlockBasedTableFactory::NewTableReader(rocksdb::ReadOptions const&, rocksdb::TableReaderOptions const&, std::unique_ptr >&&, unsigned long, std::unique_ptr >*, bool) const+0x163
C [librocksdbjni4132153615819748121.so+0x110af4a] rocksdb::TableCache::GetTableReader(rocksdb::ReadOptions const&, rocksdb::FileOptions const&, rocksdb::InternalKeyComparator const&, rocksdb::FileDescriptor const&, bool, bool, rocksdb::HistogramImpl*, std::unique_ptr >*, std::shared_ptr const&, bool, int, bool, unsigned long, rocksdb::Temperature)+0x612
C [librocksdbjni4132153615819748121.so+0x110b3d8] rocksdb::TableCache::FindTable(rocksdb::ReadOptions const&, rocksdb::FileOptions const&, rocksdb::InternalKeyComparator const&, rocksdb::FileDescriptor const&, rocksdb::Cache::Handle**, std::shared_ptr const&, bool, bool, rocksdb::HistogramImpl*, bool, int, bool, unsigned long, rocksdb::Temperature)+0x2b2
C [librocksdbjni4132153615819748121.so+0x1117fb5] rocksdb::VersionBuilder::Rep::LoadTableHandlers(rocksdb::InternalStats*, int, bool, bool, std::shared_ptr const&, unsigned long)::{lambda()#1}::operator()() const+0x1d1
C [librocksdbjni4132153615819748121.so+0x111d9af] std::_Function_handler const&, unsigned long)::{lambda()#1}>::_M_invoke(std::_Any_data const&)+0x20
C [librocksdbjni4132153615819748121.so+0x10df270] std::function::operator()() const+0x32
C [librocksdbjni4132153615819748121.so+0x1128426] void std::_Bind_simple ()>::_M_invoke<>(std::_Index_tuple<>)+0x28
C [librocksdbjni4132153615819748121.so+0x1128359] std::_Bind_simple ()>::operator()()+0x1b
C [librocksdbjni4132153615819748121.so+0x1128150] std::thread::_Impl ()> >::_M_run()+0x1c
```
### Expected behavior
The open and close calls should continue without crashing.

### Actual behavior
The code crashes under heavy load.

### Steps to reproduce the behavior
https://github.com/facebook/rocksdb/issues/8617#issuecomment-1042609708

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.