Closed Bug 2096379 Opened 10 days ago Closed 1 day ago

Don't force an in-memory SQLite temp store on 32-bit builds

Categories

(Application Services :: General, task)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jstutte, Assigned: jstutte)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

Several Application Services components set PRAGMA temp_store = 2 (MEMORY), including sql_support::setup_sqlite_defaults and the remote_settings, places, logins, tabs, relevancy, breach-alerts and webext-storage schemas.

With a memory temp store, SQLite keeps the statement sub-journal in memory with no limit. With a file temp store it starts in memory and moves to a temp file after 64 KiB (SQLITE_STMTJRNL_SPILL, see openSubJournal in sqlite3.c). So a single large write statement inside a transaction copies every page it touches into the heap.

Gecko deliberately does not use a memory temp store on 32-bit desktop builds because of address space fragmentation: third_party/sqlite3/src/moz.build only defines SQLITE_TEMP_STORE for Android and 64-bit builds. The explicit pragma overrides that choice. In bug 2095499 this makes the remote_settings orphaned-attachment migration exhaust the address space of 32-bit Firefox at startup (about 2.9 GiB of heap in the sampled reports), and the migration retries at every launch.

Proposal: skip the pragma on 32-bit targets (#[cfg(target_pointer_width = "32")]), so the build default (a file temp store) applies there. 64-bit and Android behaviour stays unchanged.

Authored by https://github.com/jensstutte
https://github.com/mozilla/application-services/commit/6595879fa44226716e9edfd688c2bebed061ed12
[main] Bug 2096379 - Don't force an in-memory SQLite temp store on 32-bit builds [ci full] (#7836)

(via GitHub webhook, authenticated as shared-secret)

Status: NEW → RESOLVED
Closed: 1 day ago
Flags: qe-verify+
Resolution: --- → FIXED
Assignee: nobody → jstutte
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: