fix(remote): reject waiters before disconnecting#3135
Open
Skn0tt wants to merge 1 commit into
Open
Conversation
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
dgozman
approved these changes
Jul 16, 2026
| # 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) |
Contributor
There was a problem hiding this comment.
Are we sure this works as expected, meaning that all existing futures from wait_for calls will be processed first?
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.
This PR aligns remote browser shutdown ordering with Playwright Node.js. Pending page and context waiters now reject before
browser.close()resolves or thedisconnectedevent fires.Waiter telemetry is best-effort during shutdown, so it can't mask the original rejection.
Closes #3097