fix(mcp): serialize shared browser launch in --isolated mode#40709
fix(mcp): serialize shared browser launch in --isolated mode#40709yury-s merged 1 commit intomicrosoft:mainfrom
Conversation
When multiple HTTP clients call tools concurrently with --isolated, the factory's create callback awaited createBrowserWithInfo before incrementing clientCount, so each concurrent caller saw clientCount === 0 and launched its own browser. Only the last assignment to sharedBrowser was tracked, leaking the rest. Replace sharedBrowser with sharedBrowserPromise that is set synchronously, so concurrent callers all await the same in-flight launch. On rejection, the slot clears so subsequent calls can retry. Fixes: microsoft/playwright-mcp#1607
Test results for "MCP"8 failed 6515 passed, 953 skipped Merge workflow run. |
Summary
--isolatedraced throughfactory.createand each launched its own browser; only the last assignment tosharedBrowserwas tracked, leaving the rest orphaned.sharedBrowserPromiseset synchronously so concurrent callers await the same in-flight launch; the slot clears on rejection to allow retries.Fixes microsoft/playwright-mcp#1607