Skip to content

fix(asyncio): do not hang when async_playwright() is cancelled while connecting - #3178

Closed
Yury Semikhatsky (yury-s) wants to merge 2 commits into
microsoft:mainfrom
yury-s:fix-42296-revert
Closed

fix(asyncio): do not hang when async_playwright() is cancelled while connecting#3178
Yury Semikhatsky (yury-s) wants to merge 2 commits into
microsoft:mainfrom
yury-s:fix-42296-revert

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • revert fix(asyncio): abort protocol calls on task cancellation #3144: waiting for the __abort__ reply in Channel._abort() absorbs the cancellation that asyncio.run() delivers at loop shutdown, so the loop never finishes closing
  • tear down via __aexit__ when __aenter__ fails or is cancelled, so the driver process does not outlive the connection (without this it dies with EPIPE once the interpreter exits)
  • allow PipeTransport.request_stop() before the driver has spawned

Alternative to #3177, which keeps #3144 and instead makes its abort path survive loop shutdown.

Fixes microsoft/playwright#42296

…elled

Cancelling __aenter__ left the driver process and the transport tasks
running with no owner, so the driver died with EPIPE once the interpreter
exited.

- tear down via __aexit__ when startup fails or is cancelled
- allow PipeTransport.request_stop() before the driver has spawned

Fixes: microsoft/playwright#42296
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]: async_playwright() leaves blocking background task if cancelled quickly

1 participant