Conversation
Two bugs both surfacing on Julia 1.10 CI: - `_finalize_txn` calls `mdb_txn_abort` on a dangling handle when `close(env)` ran first (the env close already freed the txn memory via `mdb_env_close`). Mirrors the existing defensive check in `close(::Cursor)`. - The finalizer tests relied on `GC.gc()` to synchronously run finalizers, but on Julia 1.10+ finalizers may be queued to a separate task. Switched to explicit `finalize(...)` calls so the tests no longer race the GC scheduler. Also adds a test that exercises the txn-finalized-after-env-closed ordering directly (this was reproducing the Windows access violation).
LMDB's `mdb_env_close` requires all transactions to be closed first; otherwise it leaves the lockfile/heap in a corrupted state and the next env-open in the same process crashes inside `mdb_txn_renew0`. On Julia 1.10 we got away with it (different allocator behavior), but it reliably crashed on 1.11+. Track live transactions on the Environment as `WeakRef`s and abort any still-open ones in `close(env)` before delegating to `mdb_env_close`. Tests cover both the abort-on-close path and the canary case (open a new env after misuse and confirm it survives).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #57 +/- ##
==========================================
+ Coverage 82.11% 82.41% +0.29%
==========================================
Files 9 9
Lines 755 762 +7
==========================================
+ Hits 620 628 +8
+ Misses 135 134 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Fix two bugs exposed by them.