While finishing BrowserBox 21 we used it for our own work. That week the work was signing in to dashboards: cloud consoles, a domain registrar, a mail service and Stripe. Sign-in went through everywhere, MFA included. Then the Stripe dashboard tab died while one of us was scrolling it. They opened it again and it died again.
The run that found nothing
The plan was to try signed out first, and to go into the live account, read only, if that found nothing. A script scrolled Stripe's public site and its login page for five minutes each. No tab crashed and no frame took longer than two seconds to draw. The result went into the notes as "not reproduced".
Those notes list the conditions the run was made under. One line says that BrowserBox's Chrome runs in low-end device mode. It was recorded as a fact about the setup and nobody stopped at it.
The working theory was load. The crashes had happened on a machine busy with other jobs, at a load average above 20, so the next step on the list was the same test under deliberate load.
The run that found it
The next day we ran it signed in, on a build of the release candidate, with a recorder sampling each page's memory. The dashboard home page loaded and reported 312 MiB of JavaScript heap in use. The limit for that page was 259 MiB. Six seconds later the tab was gone, and a second Stripe tab followed four seconds after it.
Chrome gave its reason in the log: V8 javascript OOM (Ineffective mark-compacts near heap limit). The page was over its memory limit and garbage collection could not bring it back under, so Chrome ended the process.
That crash came on page load, before any scrolling. In a later run without the limit, the same page loaded at 383 MiB and scrolling took it to 610. On a day when the dashboard loads just under 259, the scroll is what takes it over. That matched what we had seen the first time.
The recorder was a second client attached to the browser, which could have been the cause by itself. It was attached in the runs that did not crash too.
The load theory went too. The machine was about as busy in the runs that crashed as in the runs that did not.
Where 259 came from
Chrome has a switch called --enable-low-end-device-mode. It tells Chrome it is on a device with little memory and should save wherever it can. With the switch, a page that asks how much memory the device has is told 2 GB. On the same machine without it the answer is 8. The switch also caps each page's JavaScript heap. On our build the cap was 259 MiB, and without the switch the limit was 4,192 MiB.
BrowserBox passed that switch by default, up to and including version 20.9. It was there for small machines. A lot of people run BrowserBox on a small server with 1 or 2 GiB of memory, and a browser that saves memory is a better guest there.
We also had the number already. Twelve days earlier a comparison on our hosted containers had measured the same switch cutting the heap limit from 2,790 MB to 286 MB. It is in our internal list of settings, with the date. Our hosted launchers turn the switch off. The default for everyone who installs BrowserBox on their own machine was still on, and that was the default our own copy had been running with when the tab died.
The decision
There were two ways out. We could keep the default and turn the switch off only where we run BrowserBox ourselves. Or we could change the default for everyone.
We changed the default. The old one saved memory on a small host and killed a large web application on every host, including the ones with memory to spare. The signed-in Stripe dashboard is the kind of page people open at work every day. Someone who installs BrowserBox and opens their payments dashboard should get the page.
The change was 13 lines added and 9 removed.
It has a cost, and it went into the report next to the fix. A host with 1 or 2 GiB of memory used to get an early tab crash on a heavy page. Now it gets the heavy page and has to carry it. On a host like that you can set BBX_LOW_END_MODE=true and have the old behaviour back.
Then we ran the fixed build with nothing set. Chrome started without the switch and the page reported the 4,192 MiB limit. The dashboard loaded and scrolled with its heap at up to 594 MiB, more than twice the old cap, and no tab crashed.
What it does now
Since BrowserBox 21.0.0, low-end device mode is off unless you ask for it. A page gets the heap limit Chrome would give it on that machine. Small hosts have one setting that brings the cap back.
The first report on this bug was accurate. It described a signed-out page on a quiet machine, and that was never the page that crashed. The second run was made signed in, on the page that had crashed, and the tab was dead about twenty seconds after it loaded.