Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash at leveldb::InternalFilterPolicy::CreateFilter (C++) #1223

Open
Wagoni opened this issue Dec 25, 2024 · 0 comments
Open

Crash at leveldb::InternalFilterPolicy::CreateFilter (C++) #1223

Wagoni opened this issue Dec 25, 2024 · 0 comments

Comments

@Wagoni
Copy link

Wagoni commented Dec 25, 2024

Using the latest leveldb, the runtime environment is Ubuntu22.04.

I have tried many times, the size of xxx.log and the program crashes every time it reaches 3M.

Below is the crash stack information:

Thread 9 "FiuSrc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffef666640 (LWP 187845)]
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00005555556e6035 in leveldb::InternalFilterPolicy::CreateFilter (this=0x5555558202e0, keys=0x7fffd8013f20, n=272, dst=0x7fffd8010f80)
at /leveldb/db/dbformat.cc:110
#2 0x000055555570d9d7 in leveldb::FilterBlockBuilder::GenerateFilter (this=0x7fffd8010f40) at /leveldb/table/filter_block.cc:70
#3 0x000055555570d5fc in leveldb::FilterBlockBuilder::StartBlock (this=0x7fffd8010f40, block_offset=4106) at /leveldb/table/filter_block.cc:25
#4 0x00005555556fb15e in leveldb::TableBuilder::Flush (this=0x7fffd8010cb0) at /leveldb/table/table_builder.cc:137
#5 0x00005555556fafac in leveldb::TableBuilder::Add (this=0x7fffd8010cb0, key=..., value=...) at /leveldb/table/table_builder.cc:121
#6 0x000055555570adab in leveldb::BuildTable (dbname="Fiudb", env=0x555555800760 leveldb::Env::Default()::env_container, options=..., table_cache=0x55555581b670,
iter=0x7fffd8000ba0, meta=0x7fffef665970) at /leveldb/db/builder.cc:36
#7 0x00005555556d3b3a in leveldb::DBImpl::WriteLevel0Table (this=0x5555558202c0, mem=0x555555833aa0, edit=0x7fffef665a30, base=0x555555832390)
at /leveldb/db/db_impl.cc:519
#8 0x00005555556d3e83 in leveldb::DBImpl::CompactMemTable (this=0x5555558202c0) at /leveldb/db/db_impl.cc:557
#9 0x00005555556d4899 in leveldb::DBImpl::BackgroundCompaction (this=0x5555558202c0) at /leveldb/db/db_impl.cc:711
#10 0x00005555556d47e8 in leveldb::DBImpl::BackgroundCall (this=0x5555558202c0) at /leveldb/db/db_impl.cc:696
#11 0x00005555556d4734 in leveldb::DBImpl::BGWork (db=0x5555558202c0) at /leveldb/db/db_impl.cc:685
#12 0x00005555557065ef in leveldb::(anonymous namespace)::PosixEnv::BackgroundThreadMain (this=0x555555800760 leveldb::Env::Default()::env_container)
at /leveldb/util/env_posix.cc:850
#13 0x0000555555706256 in leveldb::(anonymous namespace)::PosixEnv::BackgroundThreadEntryPoint (env=0x555555800760 leveldb::Env::Default()::env_container)
at /leveldb/util/env_posix.cc:751
#14 0x000055555570829e in std::__invoke_impl<void, void ()(leveldb::(anonymous namespace)::PosixEnv), leveldb::(anonymous namespace)::PosixEnv*> (
__f=@0x7ffff001b8b0: 0x55555570623a <leveldb::(anonymous namespace)::PosixEnv::BackgroundThreadEntryPoint(leveldb::(anonymous namespace)::PosixEnv*)>)
at /usr/include/c++/11/bits/invoke.h:61
#15 0x0000555555708221 in std::__invoke<void ()(leveldb::(anonymous namespace)::PosixEnv), leveldb::(anonymous namespace)::PosixEnv*> (
__fn=@0x7ffff001b8b0: 0x55555570623a <leveldb::(anonymous namespace)::PosixEnv::BackgroundThreadEntryPoint(leveldb::(anonymous namespace)::PosixEnv*)>)
at /usr/include/c++/11/bits/invoke.h:96
#16 0x0000555555708191 in std::thread::_Invoker<std::tuple<void ()(leveldb::(anonymous namespace)::PosixEnv), leveldb::(anonymous namespace)::PosixEnv*> >::_M_invoke<0, 1> (this=0x7ffff001b8a8) at /usr/include/c++/11/bits/std_thread.h:259
#17 0x000055555570814a in std::thread::_Invoker<std::tuple<void ()(leveldb::(anonymous namespace)::PosixEnv), leveldb::(anonymous namespace)::PosixEnv*> >::operator() (
this=0x7ffff001b8a8) at /usr/include/c++/11/bits/std_thread.h:266
#18 0x000055555570812e in std::thread::State_impl<std::thread::Invoker<std::tuple<void ()(leveldb::(anonymous namespace)::PosixEnv), leveldb::(anonymous namespace)::PosixEnv*> > >::M_run (this=0x7ffff001b8a0) at /usr/include/c++/11/bits/std_thread.h:211
#19 0x00007ffff7ae0253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#20 0x00007ffff7766ac3 in start_thread (arg=) at ./nptl/pthread_create.c:442
#21 0x00007ffff77f8850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
(gdb) f 1
#1 0x00005555556e6035 in leveldb::InternalFilterPolicy::CreateFilter (this=0x5555558202e0, keys=0x7fffd8013f20, n=272, dst=0x7fffd8010f80)
at /leveldb/db/dbformat.cc:110
110 user_policy
->CreateFilter(keys, n, dst);
(gdb) p user_policy

$1 = (const leveldb::FilterPolicy * const) 0x7fffffffdfb0
(gdb) p *user_policy

warning: can't find linker symbol for virtual table for `leveldb::FilterPolicy' value
$2 = {_vptr.FilterPolicy = 0x7ffff7ffd040 <rtld_global>}
(gdb) p (void*) user_policy

$3 = (void *) 0x7ffff7ffd040 <_rtld_global>

Delivery is a log message:

root@iZbp1izvhfyl4sguxddvlxZ:/Fiudb# cat LOG
2024/12/25-14:32:56.587266 140737338922944 Recovering log #3
2024/12/25-14:32:56.587345 140737338922944 Reusing old log Fiudb/000003.log
2024/12/25-14:32:56.589966 140737338922944 Delete type=3 #2
2024/12/25-14:46:32.086443 140737209853504 Level-0 table #6: started

The memory space and disk space are sufficient:

root@iZbp1izvhfyl4sguxddvlxZ:/Fiudb# free -h
total used free shared buff/cache available
Mem: 7.2Gi 2.0Gi 1.1Gi 11Mi 4.1Gi 4.9Gi
Swap: 0B 0B 0B
root@iZbp1izvhfyl4sguxddvlxZ:/Fiudb# df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 740M 11M 729M 2% /run
/dev/vda3 30G 23G 4.9G 83% /
tmpfs 3.7G 0 3.7G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/vda2 197M 6.1M 191M 4% /boot/efi
tmpfs 740M 4.0K 740M 1% /run/user/0
/dev/vdb1 96G 24K 91G 1% /disk

root@iZbp1izvhfyl4sguxddvlxZ:/Fiudb# ll
total 3084
drwxr-xr-x 2 root root 4096 Dec 25 14:46 ./
drwxr-xr-x 5 root root 4096 Dec 25 14:29 ../
-rw-r--r-- 1 root root 3117439 Dec 25 14:46 000003.log
-rw-r--r-- 1 root root 76 Dec 25 14:46 000005.log
-rw-r--r-- 1 root root 4106 Dec 25 14:46 000006.ldb
-rw-r--r-- 1 root root 16 Dec 25 14:32 CURRENT
-rw-r--r-- 1 root root 0 Dec 25 14:29 LOCK
-rw-r--r-- 1 root root 267 Dec 25 14:46 LOG
-rw-r--r-- 1 root root 143 Dec 25 14:29 LOG.old
-rw-r--r-- 1 root root 50 Dec 25 14:32 MANIFEST-000004

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant