subleveldown: Segfault with subleveldown

Disclaimer: this is almost definitely my fault. I’m completely unfamiliar with leveldown and I’m probably doing everything wrong.

With that out of the way, I have a reproducible segfault while using subleveldown that’s highly correlated with open/close events.

git clone https://github.com/flumedb/flumeview-level
cd flumeview-level
git checkout -b sub
git pull origin sub
npm ci
node test/read.js

Here’s the output:

$ node test/read.js
  flumeview-level re-init +0ms
  flumeview-level re-start +2ms
  flumeview-level opened +9ms
  flumeview-level create() +0ms
FATAL ERROR: v8::Object::Cast Could not convert to object
 1: 0x55a75a67d6d1 node::Abort() [node]
 2: 0x55a75a67d71f  [node]
 3: 0x55a75a82fe9b v8::Utils::ReportApiFailure(char const*, char const*) [node]
 4: 0x7f52204e2b1c v8::Object::Cast(v8::Value*) [/home/christianbundy/src/flumeview-level/node_modules/leveldown/build/Debug/leveldown.node]
 5: 0x7f52204e490c v8::Local<v8::Object> v8::Local<v8::Object>::Cast<v8::Value>(v8::Local<v8::Value>) [/home/christianbundy/src/flumeview-level/node_modules/leveldown/build/Debug/leveldown.node]
 6: 0x7f52204e4036 v8::Local<v8::Object> v8::Local<v8::Value>::As<v8::Object>() const [/home/christianbundy/src/flumeview-level/node_modules/leveldown/build/Debug/leveldown.node]
 7: 0x7f52204e92d2 leveldown::Database::Get(Nan::FunctionCallbackInfo<v8::Value> const&) [/home/christianbundy/src/flumeview-level/node_modules/leveldown/build/Debug/leveldown.node]
 8: 0x7f52204e0ee6  [/home/christianbundy/src/flumeview-level/node_modules/leveldown/build/Debug/leveldown.node]
 9: 0x55a75a8b2ab0  [node]
10: 0x55a75a8b40d7  [node]
11: 0x2eccedadbe1d 
[1]    21605 abort (core dumped)  node test/read.js

And of course:

$ coredumpctl info 21605
           PID: 21605 (node)
           UID: 1000 (christianbundy)
           GID: 1000 (christianbundy)
        Signal: 6 (ABRT)
     Timestamp: Fri 2019-02-01 14:36:20 PST (55s ago)
  Command Line: node test/read.js
    Executable: /usr/bin/node
 Control Group: /user.slice/user-1000.slice/user@1000.service/gnome-terminal-server.service
          Unit: user@1000.service
     User Unit: gnome-terminal-server.service
         Slice: user-1000.slice
     Owner UID: 1000 (christianbundy)
       Boot ID: a26e2f3a62384290a1884245840c594f
    Machine ID: 4e83385b599d4d2ea6f5173888d92afc
      Hostname: samus
       Storage: /var/lib/systemd/coredump/core.node.1000.a26e2f3a62384290a1884245840c594f.21605.1549060580000000.lz4
       Message: Process 21605 (node) of user 1000 dumped core.
                
                Stack trace of thread 21605:
                #0  0x00007f5225387d7f raise (libc.so.6)
                #1  0x00007f5225372672 abort (libc.so.6)
                #2  0x000055a75a67d6e4 _ZN4node5AbortEv (node)
                #3  0x000055a75a67d71f n/a (node)
                #4  0x000055a75a82fe9b _ZN2v85Utils16ReportApiFailureEPKcS2_ (node)
                #5  0x00007f52204e2b1c n/a (/home/christianbundy/src/flumeview-level/node_modules/leveldown/build/Debug/leveldown.node)
                #6  0x00007f52204e490c n/a (/home/christianbundy/src/flumeview-level/node_modules/leveldown/build/Debug/leveldown.node)
                #7  0x00007f52204e4036 n/a (/home/christianbundy/src/flumeview-level/node_modules/leveldown/build/Debug/leveldown.node)
                #8  0x00007f52204e92d2 n/a (/home/christianbundy/src/flumeview-level/node_modules/leveldown/build/Debug/leveldown.node)
                #9  0x00007f52204e0ee6 n/a (/home/christianbundy/src/flumeview-level/node_modules/leveldown/build/Debug/leveldown.node)
                #10 0x000055a75a8b2ab0 n/a (node)
                #11 0x000055a75a8b40d7 n/a (node)
                #12 0x00002eccedadbe1d n/a (n/a)
                #13 0x00002ecceda918d5 n/a (n/a)
                #14 0x00002ecceda918d5 n/a (n/a)
                #15 0x00002ecceda918d5 n/a (n/a)
                #16 0x00002ecceda918d5 n/a (n/a)
                #17 0x00002ecceda918d5 n/a (n/a)
                #18 0x00002ecceda918d5 n/a (n/a)
                #19 0x00002ecceda918d5 n/a (n/a)
                #20 0x00002ecceda918d5 n/a (n/a)
                #21 0x00002ecceda918d5 n/a (n/a)
                #22 0x00002ecceda918d5 n/a (n/a)
                #23 0x00002ecceda918d5 n/a (n/a)
                #24 0x00002ecceda8ee75 n/a (n/a)
                #25 0x00002ecceda892c1 n/a (n/a)
                #26 0x000055a75ab7eb06 n/a (node)
                #27 0x000055a75ab7f03d n/a (node)
                #28 0x000055a75ab7f0f2 _ZN2v88internal9Execution4CallEPNS0_7IsolateENS0_6HandleINS0_6ObjectEEES6_iPS6_ (node)
                #29 0x000055a75a844785 _ZN2v88Function4CallENS_5LocalINS_7ContextEEENS1_INS_5ValueEEEiPS5_ (node)
                #30 0x000055a75a67e92c _ZN4node20InternalMakeCallbackEPNS_11EnvironmentEN2v85LocalINS2_6ObjectEEENS3_INS2_8FunctionEEEiPNS3_INS2_5ValueEEENS_13async_contextE (node)
                #31 0x000055a75a67ea2d _ZN4node12MakeCallbackEPN2v87IsolateENS0_5LocalINS0_6ObjectEEENS3_INS0_8FunctionEEEiPNS3_INS0_5ValueEEENS_13async_contextE (node)
                #32 0x000055a75a6639e9 _ZN4node11Environment14CheckImmediateEP10uv_check_s (node)
                #33 0x00007f52260d7241 uv__run_check (libuv.so.1)
                #34 0x00007f52260d1ab9 uv_run (libuv.so.1)
                #35 0x000055a75a688986 _ZN4node5StartEPN2v87IsolateEPNS_11IsolateDataERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EESF_ (node)
                #36 0x000055a75a686c50 _ZN4node5StartEiPPc (node)
                #37 0x00007f5225374223 __libc_start_main (libc.so.6)
                #38 0x000055a75a63f7fe _start (node)
                
                Stack trace of thread 21606:
                #0  0x00007f522544bc7e epoll_pwait (libc.so.6)
                #1  0x00007f52260e02aa uv__io_poll (libuv.so.1)
                #2  0x00007f52260d1ab0 uv_run (libuv.so.1)
                #3  0x000055a75a7091b4 _ZZN4node20BackgroundTaskRunner20DelayedTaskScheduler5StartEvENUlPvE_4_FUNES2_ (node)
                #4  0x00007f522551ba9d start_thread (libpthread.so.0)
                #5  0x00007f522544bb23 __clone (libc.so.6)
                
                Stack trace of thread 21612:
                #0  0x00007f5225521afc pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0)
                #1  0x00007f52260dd80a uv_cond_wait (libuv.so.1)
                #2  0x00007f52260ccac3 n/a (libuv.so.1)
                #3  0x00007f522551ba9d start_thread (libpthread.so.0)
                #4  0x00007f522544bb23 __clone (libc.so.6)
                
                Stack trace of thread 21615:
                #0  0x00007f5225521afc pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0)
                #1  0x00007f52260dd80a uv_cond_wait (libuv.so.1)
                #2  0x00007f52260ccac3 n/a (libuv.so.1)
                #3  0x00007f522551ba9d start_thread (libpthread.so.0)
                #4  0x00007f522544bb23 __clone (libc.so.6)
                
                Stack trace of thread 21610:
                #0  0x00007f5225521afc pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0)
                #1  0x00007f52260dd80a uv_cond_wait (libuv.so.1)
                #2  0x000055a75a706e1c n/a (node)
                #3  0x00007f522551ba9d start_thread (libpthread.so.0)
                #4  0x00007f522544bb23 __clone (libc.so.6)
                
                Stack trace of thread 21607:
                #0  0x00007f5225521afc pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0)
                #1  0x00007f52260dd80a uv_cond_wait (libuv.so.1)
                #2  0x000055a75a706e1c n/a (node)
                #3  0x00007f522551ba9d start_thread (libpthread.so.0)
                #4  0x00007f522544bb23 __clone (libc.so.6)
                
                Stack trace of thread 21608:
                #0  0x00007f5225521afc pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0)
                #1  0x00007f52260dd80a uv_cond_wait (libuv.so.1)
                #2  0x000055a75a706e1c n/a (node)
                #3  0x00007f522551ba9d start_thread (libpthread.so.0)
                #4  0x00007f522544bb23 __clone (libc.so.6)
                
                Stack trace of thread 21609:
                #0  0x00007f5225521afc pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0)
                #1  0x00007f52260dd80a uv_cond_wait (libuv.so.1)
                #2  0x000055a75a706e1c n/a (node)
                #3  0x00007f522551ba9d start_thread (libpthread.so.0)
                #4  0x00007f522544bb23 __clone (libc.so.6)
                
                Stack trace of thread 21611:
                #0  0x00007f5225524436 do_futex_wait.constprop.1 (libpthread.so.0)
                #1  0x00007f5225524538 __new_sem_wait_slow.constprop.0 (libpthread.so.0)
                #2  0x00007f52260dd894 uv_sem_wait (libuv.so.1)
                #3  0x000055a75a766e61 n/a (node)
                #4  0x00007f522551ba9d start_thread (libpthread.so.0)
                #5  0x00007f522544bb23 __clone (libc.so.6)
                
                Stack trace of thread 21613:
                #0  0x00007f5225521afc pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0)
                #1  0x00007f52260dd80a uv_cond_wait (libuv.so.1)
                #2  0x00007f52260ccac3 n/a (libuv.so.1)
                #3  0x00007f522551ba9d start_thread (libpthread.so.0)
                #4  0x00007f522544bb23 __clone (libc.so.6)
                
                Stack trace of thread 21614:
                #0  0x00007f5225521afc pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0)
                #1  0x00007f52260dd80a uv_cond_wait (libuv.so.1)
                #2  0x00007f52260ccac3 n/a (libuv.so.1)
                #3  0x00007f522551ba9d start_thread (libpthread.so.0)
                #4  0x00007f522544bb23 __clone (libc.so.6)

Please let me know if there’s anything else I can do to help debug this. Thanks a lot! I’ve been really enjoying my experience with leveldown so far.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 27 (22 by maintainers)

Commits related to this issue

Most upvoted comments

OK. FYI, it might take some time for us to find a proper fix for the subleveldown bug. Also, don’t use that #open-close-hack branch for anything other than tests 😉

Sorry, I mean that I’ve also been unable to write a minimal test case. You can still use these instructions but I haven’t had the time to whittle it down any further.

@christianbundy Do you have enough information to continue?

Are you sure the following commands are correct?

git clone https://github.com/Level/subleveldown
cd subleveldown
git checkout -b sub
git pull origin sub
npm ci
node test/read.js