Repository navigation
Upgrade upstream LMDB to 0.9.35 - #43
Conversation
Upstream change log:
LMDB 0.9.35 Release (2026/01/27)
ITS#10434 - Fix typo affecting Mac OSX
LMDB 0.9.34 Release (2026/01/26)
ITS#9564 - fix race condition freeing spilled pages at end of transaction
ITS#10222 - Update mdb_dump(1) and mdb_load(1) man pages for append (-a) option
ITS#10275 - mdb_load: add -Q option to use NOSYNC
ITS#10296 - fix fdatasync on MacOS
ITS#10342 - fix memleak in mdb_txn_begin for nested txns
ITS#10346 - fix mdb_env_copy2 with values > (2GB-16)
ITS#10355 - fix mplay build on musl
ITS#10396 - fix mdb_cursor_del0 with multiple DUPSORT cursors
ITS#10419 - add support for NetBSD
ITS#10420 - add support for Haiku
ITS#10421 - mdb_load: check for malicious input
There was a problem hiding this comment.
🟡 Changes recommended
The updated LMDB C code introduces a confirmed double-free risk in the txn-begin error path and a truncation risk in the copy thread’s write return handling for large writes.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates the vendored LMDB C library in this Go binding to upstream LMDB 0.9.35, incorporating the upstream fixes listed in the changelog (MacOS fdatasync fix, spill-page race fix, nested-txn leak fix, NetBSD/Haiku support, etc.).
Changes:
- Bump vendored LMDB version macros/date and update upstream changelog.
- Pull in upstream LMDB C updates (platform fsync handling, txn cleanup, cursor delete fix, copy thread sizing fixes).
- Update the update script to also sync
midl.c/midl.h, and refresh README badges.
File summaries
| File | Description |
|---|---|
| update-lmdb.sh | Also copies midl.c/midl.h from upstream during updates. |
| README.md | Updates release/C-version badges to reflect the new versions. |
| lmdb/midl.h | Syncs upstream header updates (copyright, MDB_IDL_LOGN override). |
| lmdb/midl.c | Syncs upstream IDL implementation updates (copyright). |
| lmdb/mdb.c | Main upstream LMDB changes: platform sync semantics, txn cleanup, cursor delete fix, and copy-thread size type updates. |
| lmdb/lmdb.h | Bumps LMDB patch version/date macros to 0.9.35 / 2026-01-27. |
| CHANGES.lmdb.txt | Adds 0.9.34 and 0.9.35 upstream changelog entries. |
Review details
Suppressed comments (1)
lmdb/mdb.c:9212
- On non-Windows builds, the copy thread stores write(2)'s return value in an int. With mc_wlen/mc_olen/wsize now size_t, wsize can exceed INT_MAX (e.g. large overflow-page tails), and truncating the ssize_t return value can turn a successful large write into a negative/incorrect len, breaking the copy loop.
int toggle = 0, rc;
size_t wsize;
#ifdef _WIN32
DWORD len;
#define DO_WRITE(rc, fd, ptr, w2, len) rc = WriteFile(fd, ptr, w2, &len, NULL)
#else
int len;
#define DO_WRITE(rc, fd, ptr, w2, len) len = write(fd, ptr, w2); rc = (len >= 0)
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (rc) { | ||
| if (txn != env->me_txn0) | ||
| if (txn != env->me_txn0) { | ||
| free(txn->mt_u.dirty_list); | ||
| free(txn); | ||
| } |
There was a problem hiding this comment.
This is an upstream bug in 0.9.34 and .35, created #44 to track. No action planned in this PR.
|
@codex review |
Luit
left a comment
There was a problem hiding this comment.
One question: why not 0.9.36?
Good catch, I through .35 was the latest... I will update to .36. |
Luit
left a comment
There was a problem hiding this comment.
Because of the regressions of .36, LGTM.
Indeed, because of the regressions in .36 (see #47) we will do .35 first. |
Co-authored-by: Luit van Drongelen <github@luit.freedom.nl>
Upstream change log: