Skip to content

Conversation

@mxschmitt
Copy link
Contributor

@mxschmitt mxschmitt commented Mar 18, 2022

This fixes the following warning which go emitted:

Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x000002674D05BF78>
Traceback (most recent call last):
  File "C:\Python\lib\asyncio\base_subprocess.py", line 127, in __del__
  File "C:\Python\lib\asyncio\base_subprocess.py", line 104, in close
  File "C:\Python\lib\asyncio\proactor_events.py", line 86, in close
  File "C:\Python\lib\asyncio\base_events.py", line 694, in call_soon
  File "C:\Python\lib\asyncio\base_events.py", line 480, in _check_closed
RuntimeError: Event loop is closed

and the following warning which got emitted:

Loop <_UnixSelectorEventLoop running=False closed=True debug=False> that handles pid 1923783 is closed

Fixes #1152
Fixes #939
Fixes #818
Fixes #984
Fixes #1254
Relates #966

Repros:

from playwright.sync_api import sync_playwright

for i in range(300):
    print(i)
    with sync_playwright() as playwright:
        pass
from playwright.sync_api import sync_playwright


def run(playwright):
    browser = playwright.chromium.connect_over_cdp("http://localhost:9222")
    page = browser.new_page()
    page.goto("http://example.com/")


for i in range(300):
    print(i)
    with sync_playwright() as playwright:
        run(playwright)

@mxschmitt mxschmitt changed the title fix: loop closed exception which got emitted in subprocess destructor fix: enhance process close procedure Mar 23, 2022
@mxschmitt mxschmitt marked this pull request as ready for review March 23, 2022 12:00
@mxschmitt mxschmitt force-pushed the fix-loop-closed branch 2 times, most recently from c9846b7 to 62a2d8c Compare March 25, 2022 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants