Skip to content

Upgrade upstream LMDB to 0.9.35 - #43

Merged
wojas merged 2 commits into
PowerDNS:masterfrom
wojas:upgrade-0-9-35
Sep 9, 2026
Merged

wojas merged 2 commits into
PowerDNS:masterfrom
wojas:upgrade-0-9-35

Conversation

@wojas

@wojas wojas commented Sep 3, 2026

Copy link
Copy Markdown
Member

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

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
@wojas wojas added this to the v1.9.4 milestone Sep 3, 2026
@wojas
wojas requested a lite review from Copilot September 3, 2026 14:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread lmdb/mdb.c
Comment on lines 2984 to +2988
if (rc) {
if (txn != env->me_txn0)
if (txn != env->me_txn0) {
free(txn->mt_u.dirty_list);
free(txn);
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an upstream bug in 0.9.34 and .35, created #44 to track. No action planned in this PR.

@wojas

wojas commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

@codex review

@Luit Luit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question: why not 0.9.36?

Comment thread README.md Outdated
@wojas

wojas commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

One question: why not 0.9.36?

Good catch, I through .35 was the latest... I will update to .36.

@Luit Luit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the regressions of .36, LGTM.

@wojas

wojas commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

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>
@wojas
wojas merged commit 6b37db4 into PowerDNS:master Sep 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants