-
Notifications
You must be signed in to change notification settings - Fork 72
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
Double free issue when using a cursor #133
Comments
I think I have located the possible cause.
If I create a separate cursor variable ("cursor2) for the 2nd use of a cursor, the issue does not occur. It's only if I reuse the 1st declaration of "cursor" |
@nwbrad Thanks for reporting this. Can you please run If you are unfamiliar with gdb, this is how to launch it:
Inside |
I would also appreciate it if you could give me a test case that reproduces this. |
below is the backtrace.
|
@nwbrad Can you please repeat that but using a debug build? So that we can see line numbers in there. The backtrace itself is enough, I can't use the memory map. |
I ran debuginfo-install nodejs-8.11.3-1nodesource.x86_64 to install debug source, but I got an error message: Could not find debuginfo for main pkg: 2:nodejs-8.11.3-1nodesource.x86_64 |
@nwbrad What I would like to see is line numbers in node-lmdb. For that you don't need the nodejs debuginfo, it is enough to make a debug build of node-lmdb. |
I don't think this worked like expected because I don't see any line numbers for node-lmdb.
|
But you don't need to. You only need a debug build of node-lmdb, not node. git clone [email protected]:Venemo/node-lmdb.git
cd node-lmdb
node-gyp configure --debug
node-gyp build --debug Then use the resulting binaries from this build. |
Ok. Tried above and got the following for line 3
|
I think I have it now:
|
Thank you @nwbrad the relevant line seems to be Can you give me a small javascript testcase, so that I can experiment with it? |
Below is the function in which the error occurs. All logic related to other things has been removed, so it just shows the LMDB logic I used. The issue appears to occur when I reuse the Cursor variable. If I create a second cursor variable and close the cursors before I commit the transactions, the issue does not appear to happen... convertTable(env, tblDbi, tblName, dataType) {
|
Not sure what would cause this but I'll investigate. Sorry for the slow reply. |
It does seem a bit odd how it occurs. Thanks for the help. |
@nwbrad Does it only occur with one specific database, though? |
Sort of. It is one specific Environment, I tried multiple copies of the Environment, restored from backup and tried older versions, all the same result. Nothing fancy about the Environment. It has databases that originally used Int Keys and String Keys to store either strings or numbers. The app that has the issue access LMDB through using binary/buffer access methods to convert utf16 string to utf8 strings and in some databases converts values from number values to utf8 strings. (Now all my programs use the binary/buffer process with LMDB. As I started using C and Java to access the same LMDB the utf16 and null terminator started causing issues. Plus I wanted to support 64 bit integers.) The environment in question has 4 databases in it and seems to work fine other than this issue. |
@nwbrad Can you give me some version of this environment (possibly with some dummy data) where I can reproduce this problem? |
I won't have time this week to do it, but I will try the week after next. |
Thanks @nwbrad I'm looking forward to seeing it. |
@nwbrad Any news about this? If you can give me a dataset and some code with which the issue is reproducible I am fairly sure I can fix the problem. However without that I would be just shooting in the dark. |
Sorry, I'm caught up in a few other things I need to get done. I probably won't be able to look at this for a couple of weeks. If you want to close it and I can reopen it when I have time to create data for it, that would be okay. |
@nwbrad No problem, we can keep this open for a few more weeks. In the meantime if any other user encounters the same or similar issue, they can chime in too. |
Five years late to the party but for what it's worth I had a similar problem and found that closing any cursor before commiting the transaction fixed the issue for me. |
I'm afraid this issue is probably scant on details, but here it goes.
I'm getting an error in a program I wrote using node-lmdb. The error only occurs when I run the program, not when I debug the program, so I'm unable to tell where exactly in the program the error is occurring. The backtrace seems to indicate the issue is in CursorWrap...
I have 2 functions that I call 2 times each:
Both functions access the same env, but different dbi's. I can run each function individually, and I have no problem. The error only occurs when I call all four functions in a row. I can run any combination of the 4 (ie the first 3, the last 3, etc) and no error occurs. It is only when I call all four that the issue occurs.
The message from node is below. Is there anything more I can do to see where the error is coming from please let me know.
The text was updated successfully, but these errors were encountered: