Skip to content

fix(remote): reject waiters before disconnecting#3135

Merged
Skn0tt merged 1 commit into
microsoft:mainfrom
Skn0tt:skn0tt-fix-3097-remote-close-ordering
Jul 17, 2026
Merged

fix(remote): reject waiters before disconnecting#3135
Skn0tt merged 1 commit into
microsoft:mainfrom
Skn0tt:skn0tt-fix-3097-remote-close-ordering

Conversation

@Skn0tt

@Skn0tt Skn0tt commented Jul 16, 2026

Copy link
Copy Markdown
Member

This PR aligns remote browser shutdown ordering with Playwright Node.js. Pending page and context waiters now reject before browser.close() resolves or the disconnected event fires.

Waiter telemetry is best-effort during shutdown, so it can't mask the original rejection.

Closes #3097

Align remote browser shutdown ordering with Playwright Node.js so pending waiters reject before browser.close() resolves or the disconnected event fires.\n\nFixes: https://github.com/microsoft/playwright-python/issues/3097\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 92a37978-021a-44a3-9617-739f54ff37f1
@Skn0tt
Skn0tt requested a review from dgozman July 16, 2026 08:58
# The order of rejects vs closure is a part of the API contract and our test runner
# relies on it to attribute rejections to the right test.
if browser:
connection._loop.call_soon(browser._on_close)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure this works as expected, meaning that all existing futures from wait_for calls will be processed first?

@Skn0tt
Skn0tt merged commit 72fb0e0 into microsoft:main Jul 17, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Remote browser close should reject pending waiters before disconnect events

2 participants