Repository navigation
fix(proxy): use working-set memory for the Windows solver cap - #93
Merged
Merged
Conversation
On Windows the solver's cap was a Job Object limit on commit charge, and the footprint the solver reported was commit charge as well. A Bun process commits far more than it uses. Measured with Bun 1.4.2 on 16 logical processors, the solver's commit charge was about 100 MB before it had loaded anything and 460 to 560 MB during its first solve, at 200 to 245 MB of working set. Under the 300 MB default every solver process ran out of memory within seconds of its start, and no solve finished. The solver process now measures its working set on Windows and ends itself at the cap, as it does where the operating system enforces nothing. The Job Object stays as the bound the kernel enforces, 1024 MB of commit charge above the cap, so a solver that commits memory without touching it is still stopped. Linux and macOS measure as before. The solver is now replaced at 50 % of the cap, down from 80 %. A real solve peaks up to about 120 MB above the footprint it starts from and leaves about 40 MB behind, on Windows and on Linux. With 60 MB of room, two of four generations on Windows ended at the cap on their third solve. At the default cap a solver process now serves one solve on Windows and two on Linux, where it served four.
The manifest lists the change to the vendored proxy. The READMEs, the architecture notes and the glossary give the 50 % recycle threshold, and the architecture notes say how the cap is enforced on Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The captcha solver dies within seconds on Windows with the default 300 MB cap. Bun 1.4.2 commits memory it has not touched: crash reports show 66–96 MB of working set when the Windows Job Object reaches its 300 MB commit limit.
Changes
solver.memoryCapMB. Its watcher checks every 100 ms and exits when the cap is reached.The default remains 300 MB. No installed proxy or user configuration was changed.
Verification
solver-cap.test.ts,solver-process.test.tsandsolver-recycle.test.ts: 74 passed, 2 skipped, 0 failed.test-support/egress-guard.test.tsand also fails on untouched6b1e520; this PR does not change it.6b1e520in that setup. Real solves under the cgroup cap: 5/5, with no cap exits.Limits and follow-up