Skip to content

Increase sqlite3_hard_heap_limit64 to 8 GiB behind an autogate#6570

Merged
joshthoward merged 1 commit intomainfrom
jhoward/STOR-5107
Apr 13, 2026
Merged

Increase sqlite3_hard_heap_limit64 to 8 GiB behind an autogate#6570
joshthoward merged 1 commit intomainfrom
jhoward/STOR-5107

Conversation

@joshthoward
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk bot left a comment

Choose a reason for hiding this comment

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

I'm Bonk, and I've done a quick review of your PR.

This PR increases the SQLite sqlite3_hard_heap_limit64 from 512 MiB to 8 GiB behind the INCREASE_SQLITE_HARD_HEAP_LIMIT autogate.

Issues (ranked by severity):

  1. (Low) Autogate naming mismatch: enum vs string name word ordering is inconsistent, breaking the convention every other autogate follows.
  2. (Low) Minor grammar nit in the comment.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Apr 13, 2026

Review posted successfully on PR #6570. I found two low-severity issues:

  1. Autogate naming mismatch: The enum INCREASE_SQLITE_HARD_HEAP_LIMIT doesn't match the string sqlite-increase-hard-heap-limit (words are reordered). Every other autogate in the file follows the convention of matching the kebab-case of the enum name. Suggested fix provided.

  2. Grammar nit: "a 8 GiB" should be "an 8 GiB" in the comment. Suggested fix provided.

The core change itself -- gating the heap limit increase behind an autogate with the static bool doOnce pattern -- is sound. The autogate is initialized before any SQLite database is created in normal server startup, and the process-wide limit only needs to be set once.

github run

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@joshthoward joshthoward marked this pull request as ready for review April 13, 2026 18:57
@joshthoward joshthoward requested review from a team as code owners April 13, 2026 18:57
@joshthoward joshthoward enabled auto-merge April 13, 2026 18:57
Copy link
Copy Markdown
Member

@a-robinson a-robinson left a comment

Choose a reason for hiding this comment

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

Does the higher limit have any negative effect on how much memory workerd uses locally? I’d imagine not since it’s just a limit and nothing gets preallocated?

@joshthoward joshthoward merged commit c6b68b7 into main Apr 13, 2026
22 of 23 checks passed
@joshthoward joshthoward deleted the jhoward/STOR-5107 branch April 13, 2026 19:05
@joshthoward
Copy link
Copy Markdown
Contributor Author

joshthoward commented Apr 13, 2026

@a-robinson

Does the higher limit have any negative effect on how much memory workerd uses locally? I’d imagine not since it’s just a limit and nothing gets preallocated?

Nothing about this should change the amount of memory allocated by SQLite other than the fact that queries which previously needed more than 512 MiB of memory would fail with SQLITE_NOMEM. SQLite will have a connection free memory in its page cache once the soft limit is exceeded. Raising this could allow for memory consumption to remain higher, but we aren't modifying that for now (we don't want cached DB pages to consume sandbox memory).

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.

2 participants