Skip to content

0.133.1: Hosted runs keep writing run.json past 512 MiB of traces

Choose a tag to compare

@danielgwilson danielgwilson released this 14 Oct 07:38
· 121 commits to main since this release
6e32340

humanish 0.133.1 keeps a hosted run writing run.json once its finished participants' traces
together pass V8's longest string, 536,870,888 characters. The sandbox id scrub serialized the whole
bundle into one string on every write, so past that size every write threw and run.json, the trace
files, review.json and events.ndjson stopped updating. It now scrubs the bundle and each participant
apart and writes the same bytes. On synthetic runs at a recorded hosted run's density, a snapshot
write of 10 participants of 10 MiB took 3.8 seconds where it took 4.7, at half the peak memory.

Fixes

  • A hosted run keeps writing run.json once its finished participants' traces together pass V8's longest string, 536,870,888 characters. The sandbox id scrub serialized the whole bundle, every finished trace included, into one string on each snapshot write and on the final write, so past that size every write threw RangeError: Invalid string length before run.json, the trace files, review.json or events.ndjson changed. The scrub now serializes the bundle without its traces and then each participant on its own, and writes the same bytes as before. A sandbox id that holds JSON punctuation, a quote or a backslash still goes through the scrub of the whole text; no E2B id holds one. The timings below used synthetic bundles whose trace items repeat a recorded hosted run's, about 13 bytes per JSON token. With 10 participants of 10 MiB each, a snapshot write took 3.8 seconds where it took 4.7, and the process peaked at 1.3 GiB where it peaked at 2.7 GiB. With 25 participants of 30 MiB each, the scrub took 18 seconds of a 37-second snapshot write, and the process peaked at 4.4 GiB. That run still cannot finish: each 30 MiB trace is written indented as a 44 MB file, past the 32 MiB humanish reads of one run file, so the sandbox id sweep at finish and the export's verify both stop on it (#1877). The bundle estimate's warning for traces past 512 MiB no longer names the run.json writer. (#1870)

Measured before and after

Synthetic hosted bundles whose trace items repeat a recorded hosted run's, about 13 bytes per JSON token, measured back to back:

0.133.0 0.133.1
10 participants x 10 MiB, snapshot write 4.7 s, 2.7 GiB peak 3.8 s, 1.3 GiB peak
25 participants x 30 MiB, snapshot write RangeError, no run.json 37 s, 4.4 GiB peak; run.json indexes 25 traces and names no raw id

The 25 x 30 MiB run still cannot finish: each 30 MiB trace is written indented as a 44 MB file, past the 32 MiB humanish reads of one run file (#1877). The release changes nothing a participant sees or does and nothing the analysis reads, so the efficacy benchmark was not rerun; the 0.133.0 result stands.