You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Observed behavour:
I'm developing something that is working with both playwright and other cpu intensive processing at the same time, so with playwright open I call out to run something in a process pool. That works, but then when I'm leaving the playwright context block, playwright hangs.
Expected behaviour:
Running something in a process pool while playwright is open will have no effect on playwright itself, and it will just leave the context block as normal.
For the code snippet:
You can comment/uncomment whichever asyncio.run you want in the if __name__ == "__main__": - the function names just describe if they hang or not.
The two lines at the top of the file are sort of a workaround, in that if you uncomment them it doesn't hang, but 'spawn' has other problems, and the default ('fork') is preferred.
If I do run with set_start_method('spawn', True), I get the following output, which may be useful in debugging:
playwright is open
<_UnixSelectorEventLoop running=True closed=False debug=False>
sync_function: args
Result of sync_function
We _do_ get here
We don't get here
/usr/lib/python3.7/multiprocessing/semaphore_tracker.py:144: UserWarning: semaphore_tracker: There appear to be 5 leaked semaphores to clean up at shutdown
len(cache))
/usr/lib/python3.7/multiprocessing/semaphore_tracker.py:144: UserWarning: semaphore_tracker: There appear to be 5 leaked semaphores to clean up at shutdown
len(cache))
/usr/lib/python3.7/multiprocessing/semaphore_tracker.py:144: UserWarning: semaphore_tracker: There appear to be 5 leaked semaphores to clean up at shutdown
len(cache))
/usr/lib/python3.7/multiprocessing/semaphore_tracker.py:144: UserWarning: semaphore_tracker: There appear to be 5 leaked semaphores to clean up at shutdown
len(cache))
Actually the last function ( yet_another_thing_that_does_not_hang ) may be the best clue as to what's happening: if I run something in the process pool before entering async_playwright() then running a thing inside there doesn't fork a new process, and the context exits cleanly
Playwright version
1.17.2
Operating system
Linux
What browsers are you seeing the problem on?
Chromium
Other information
Tested in python 3.7.3 and python 3.8.10
What happened? / Describe the bug
Observed behavour:
I'm developing something that is working with both playwright and other cpu intensive processing at the same time, so with playwright open I call out to run something in a process pool. That works, but then when I'm leaving the playwright context block, playwright hangs.
Expected behaviour:
Running something in a process pool while playwright is open will have no effect on playwright itself, and it will just leave the context block as normal.
For the code snippet:
You can comment/uncomment whichever
asyncio.run
you want in theif __name__ == "__main__":
- the function names just describe if they hang or not.The two lines at the top of the file are sort of a workaround, in that if you uncomment them it doesn't hang, but 'spawn' has other problems, and the default ('fork') is preferred.
If I do run with
set_start_method('spawn', True)
, I get the following output, which may be useful in debugging:Actually the last function (
yet_another_thing_that_does_not_hang
) may be the best clue as to what's happening: if I run something in the process pool before enteringasync_playwright()
then running a thing inside there doesn't fork a new process, and the context exits cleanlyCode snippet to reproduce your bug
Relevant log output
No response
The text was updated successfully, but these errors were encountered: