Repository navigation
Conversation
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.
Summary
Named Playwright executors were capped at a fixed 8 per browser. Each one runs its own daemon process (90-130 MiB RSS) and owns a tab, so on a ~975 MiB headless VM the 4th executor already failed setup with 500s (
open tab: Target.createTarget: context deadline exceeded,not ready within 5s). MemAvailable then dropped to ~20 MiB and calls on thedefaultexecutor started failing with EOF or page crashes. The 409 limit was never reached; the VM ran out of memory first. Headful and GPU VMs (6-8 GiB) handle all 8.The limit is now set from memory when the API starts:
memoryisMemTotalfrom/proc/meminfo, lowered to the cgroup v2memory.maxwhen one is set, so adocker run --memorycontainer gets the same treatment as a VM.The 409 response shape is unchanged:
messagereports the limit actually in effect (named executor limit (2) reached; ...) andexecutorslists them. The/playwright/executedescription inopenapi.yamlnow describes the memory-based limit, andoapi.gois regenerated (only the embedded spec changed).Testing
go vet ./...andgo test -raceover every non-e2e package pass.TestPlaywrightExecutorLimitFromMemory: the formula at each boundary.TestVMMemoryBytes: MemTotal parsing, amaxcgroup, a cgroup below or above MemTotal, a missing cgroup file, a missing MemTotal.TestPlaywrightExecutorLimitBelowMax: a limit of 2 returns the limit error with(2)on the 3rd executor, anddefaultstill works.--memory=1g: loggedmemory_bytes=1073741824 limit=2. Executorsaandbreturned 200;creturned 409 withnamed executor limit (2) reached;defaultstill returned 200. AfterDELETE /playwright/executors/a,creturned 200.limit=8.e1-e8returned 200 ande9returned 409 withnamed executor limit (8) reached.Not tested: a real ~975 MiB unikernel VM. The container check covers the cgroup path; the
/proc/meminfopath is covered by unit tests.Follow-ups outside this repo
The public API and its clients still say "at most 8 named executors". That reads wrong on headless browsers after this ships: kernel/kernel
packages/api/openapi.yaml(from which the Node, Python and Go SDK docstrings are generated), the docs pagebrowsers/playwright-execution.mdxand its changelog entry, the CLIbrowsers playwrighthelp text, and the MCP server's playwright tool description. The public API forwards the in-VM 409message, so the actual limit reaches callers unchanged.