Closed Bug 1739761 Opened 4 years ago Closed 4 years ago

Investigate the large amount of heap fragmentation in the hunspell RLBox sandbox

Categories

(Core :: Security: RLBox, defect, P3)

x86
All
defect

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: shravanrn, Assigned: bholley)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

Attachments

(2 files)

When investigating Bug 1737841 which looked at the large memory consumption of the hunspell spellchecking code when checking the "bg" locale, we see that when hunspell is run in a rlbox sandbox there is a large amount of fragmentation

For example bg requires about 23.26mb in the sandbox to perform spellchecking.

When allocating a 16mb sandbox, spellchecking uses 11.67mb out of 16mb used and then crashes with OOM
When allocating a 32mb sandbox, spellchecking uses 22.53mb out of 32mb used and then crashes with OOM
When allocating a 64mb sandbox, spellchecking uses 23.26mb out of 64mb used and succeeds

This seems to be a rather high level of fragmentation

This reduces the number of wasm pages allocated from 64 to 47 on en_us
builds, corresponding to about 1 MB of reduced memory usage.

Assignee: nobody → bholley
Status: NEW → ASSIGNED
Pushed by bholley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/74f7e61f745f arena-allocate strings in hunspell. r=glandium https://hg.mozilla.org/integration/autoland/rev/97263298aa24 Scale down the hunspell sandbox size calculation to account for reduced fragmentation. r=shravanrn

Backed out for causing failures on test_hunspell.js

03:04:52 WARNING - TEST-UNEXPECTED-FAIL | extensions/spellcheck/hunspell/tests/unit/test_hunspell.js | xpcshell return code: -11
03:04:53 INFO - PID 3328 | Assertion failed: outstanding_arena_allocations == 0 (/builds/worker/checkouts/gecko/extensions/spellcheck/hunspell/src/hashmgr.cxx: ~HashMgr: 164)
03:04:53 INFO - PID 3328 | Hit MOZ_CRASH(wasm2c crash: wasm2c: WASM_RT_TRAP_UNREACHABLE) at /builds/worker/checkouts/gecko/config/external/rlbox_wasm2c_sandbox/rlbox_wasm2c_thread_locals.cpp:30
03:04:55 WARNING - PROCESS-CRASH | extensions/spellcheck/hunspell/tests/unit/test_hunspell.js | application crashed [@ moz_wasm2c_trap_handler]
Flags: needinfo?(bholley)
Pushed by bholley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b658492a6895 arena-allocate strings in hunspell. r=glandium https://hg.mozilla.org/integration/autoland/rev/8aed6a301f1e Scale down the hunspell sandbox size calculation to account for reduced fragmentation. r=shravanrn
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
Flags: needinfo?(bholley)
Regressions: 1748408
Blocks: 1758626
Regressions: 1844117
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: