kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
520 stars 44 forks source link

`openDB` fails hard on new database in `lmdb-js` 3.0.0 #282

Closed pkaminski closed 8 months ago

pkaminski commented 8 months ago

This code works fine in 2.9.4 but immediately exits the process with a code of 3 when running against lmdb-js 3.0.0 and the database doesn't already exist:

require('lmdb').open({}).openDB('foo', {})

Node v20.11.1 on Windows 10 (64 bit) build 19045.

kriszyp commented 8 months ago

So far, I haven't had any luck reproducing this. I can't reproduce locally on my linux box, and I can't reproduce on GH's Windows runners. I will try again, next time I have more access to other Windows boxes at another location. You haven't been able to determine any particular cause/effect (does everything immediately fail?)?

pkaminski commented 8 months ago

I played around with this a bit more and it repros consistently for me. The process literally dies on the spot as soon as I make the call to openDB so I assume the failure is in native code. (When using the REPL Node doesn't even manage to append the command to its history file!)

I don't know if the process exit code of 3 is relevant, or just some artifact of Node. Apparently it's used to signal "Internal JavaScript Parse Error", whatever that means.

One thing I did notice is that if I create the sub-DB using v2.9.4 first then v3.0.0 can open it just fine; it's only when v3.0.0 tries to openDB with a name that was never used before that it crashes. Perhaps this narrows the area of the code that might be responsible?

I don't have experience with debugging native modules in Node, but if you point me to some tooling then I'm happy to try to gather more debug information for you. Thanks!

kriszyp commented 8 months ago

Should be fixed in v3.0.1.

pkaminski commented 8 months ago

Confirmed, thank you!