gh-185 Add protection for closed env#186
Closed
at055612 wants to merge 4 commits intolmdbjava:masterfrom
Closed
Conversation
Change Cursor and Txn to hold the Env instance so it can be checked for its open/closed state. Add calls to env.checkNotClosed() in methods that call out to the LMDB lib to prevent the JVM crashing if the env has been closed. Add lots of tests involving env closure.
Collaborator
Author
|
@benalexau If I run the test classes in isolation they work fine but when run via My suspicion (with zero c knowledge) is that the various tests that are closing the env while txns/cursors/dbis are open are leaving things (i.e. mutex locks) in an untidy state that are then causing later tests to fail. Does this seem right and is there any way to get around this? An alternative approach would be for the Env to keep a track of open txns/cursors and either prevent closure of the env if any are open or force closure of the open txns/cursors. Such an approach would add overhead though. |
0a78414 to
a1162e1
Compare
bp-alex
added a commit
that referenced
this pull request
Feb 3, 2023
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #185
Happy to re-work this if you disagree with the approach or see problems with it.