kriszyp / lmdb-js

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

1.6.1 TypeError: getAddress is not a function #74

Closed 1N50MN14 closed 3 years ago

1N50MN14 commented 3 years ago

I'm currently on 1.5.3, wanted to take 1.6.1 for a spin using backup() data prior to upgrading, the following error gets thrown:

[1626178102631] ERROR (TypeError/31713 on dfv):
    columnNumber: 20
    lineNumber: 1338
    fileName: "/home/am/dev/dfv/platform/database/main/node_modules/lmdb-store/index.js"
    functionName: "allocateSaveBuffer"
    source: "at allocateSaveBuffer (/home/am/dev/dfv/platform/database/main/node_modules/lmdb-store/index.js:1338:20)"
    stack: "TypeError: getAddress is not a function\n    
    at allocateSaveBuffer (/home/am/dev/dfv/platform/database/main/node_modules/lmdb-store/index.js:1338:20)
    at saveKey (/home/am/dev/dfv/platform/database/main/node_modules/lmdb-store/index.js:1345:3)
    at position (/home/am/dev/dfv/platform/database/main/node_modules/lmdb-store/index.js:815:20)
    at Object.next (/home/am/dev/dfv/platform/database/main/node_modules/lmdb-store/index.js:848:18)

Running Debian 10 / Node 14.15.0 on my local machine.

kriszyp commented 3 years ago

Is it possible that when upgrading lmdb-store, that it hasn't been recompiled (this should happen on npm install, but not automatically if you just copying files)? getAddress is a new native function in v1.6, so this error would happen if the v1.6 JS is running with the v1.5 built C++ code.

1N50MN14 commented 3 years ago

Oh you were totally right, removed node_modules and reinstalled, it worked. Many thanks!

kriszyp commented 3 years ago

Just out of curiosity, did you previously upgrade with npm install, but it didn't work without removal node_modules? (I hope it doesn't require removal of node_modules to get it to rebuild)

1N50MN14 commented 3 years ago

Previously I had just bumped the version in my package.json and simply yarn install... I can keep track on this and report back if I encounter a similar issue in the future. In production this should be ok since the container is going to be rebuilt anyway (Edit: at least for me, but I'll keep an eye on it).

kriszyp commented 3 years ago

Ok, interesting, I would certainly expect this to rebuild. I'll check out if maybe anything behaves differently with yarn.

1N50MN14 commented 3 years ago

Let me remove node_modules, downgrade to 1.5.3 and upgrade again, once sec

1N50MN14 commented 3 years ago

Let me remove node_modules, downgrade to 1.5.3 and upgrade again, once sec

Ok so this worked, no issues this time, hopefully it was just an isolated cache glitch..

1N50MN14 commented 3 years ago

I performed another test, downgraded to 1.5.3 from 1.6.1 (without removing node_modules), this time it errored:

/home/am/dev/dfv/platform/database/main/node_modules/lmdb-store/build/Release/lmdb-store.node(+0x2bff7)[0x7f8860a16ff7]
/lib/x86_64-linux-gnu/libc.so.6(+0x37840)[0x7f8863286840]
/home/am/dev/dfv/platform/database/main/node_modules/lmdb-store/build/Release/lmdb-store.node(+0x2e94d)[0x7f8860a1994d]
/home/am/dev/dfv/platform/database/main/node_modules/lmdb-store/build/Release/lmdb-store.node(+0x373ce)[0x7f8860a223ce]
/home/am/dev/dfv/platform/database/main/node_modules/lmdb-store/build/Release/lmdb-store.node(+0x346e8)[0x7f8860a1f6e8]
/home/am/n/bin/node[0xbe369b]
/home/am/n/bin/node[0xbe4c46]
/home/am/n/bin/node(_ZN2v88internal21Builtin_HandleApiCallEiPmPNS0_7IsolateE+0x16)[0xbe52c6]
/home/am/n/bin/node[0x13ff259]

Upgraded again to 1.6.1 and it worked fine again

kriszyp commented 3 years ago

Well thanks for giving it a try anyway!

1N50MN14 commented 3 years ago

Well thanks for giving it a try anyway!

Thanks for being patient and responsive, as always ;)

kriszyp commented 3 years ago

Yeah, I actually can reproduce this. If you update your package.json to a version that you have previously installed and run yarn install, yarn doesn't seem to properly recompile. It seems to be specific to yarn, going back and forth with versions with npm install seems to work fine.

1N50MN14 commented 3 years ago

Ah great, then we know for future reference

kriszyp commented 3 years ago

FWIW, I think this is fixed in Yarn v2.