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
Browser.start() adds newly launched process in registered instances and then tries to connect to the browser. But in case of slow hardware or high system load, Chrome takes some time to response and nodriver throws Failed to connect to browser and exits.
atexit handler util.deconstruct_browser() calls browser.stop() while exiting but since browser.connection haven't initialized yet, it fails with AttributeError. Leaving the running but unresponsive chrome in orphan state.
Exception:
Exception ignored in atexit callback: <function deconstruct_browser at 0x786c14bc85e0>
Traceback (most recent call last):
File "/home/pyenv/lib/python3.12/site-packages/nodriver/core/util.py", line 138, in deconstruct_browser
_.stop()
File "/home/pyenv/lib/python3.12/site-packages/nodriver/core/browser.py", line 553, in stop
asyncio.get_event_loop().create_task(self.connection.aclose())
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'aclose'
Fix:
In nodriver.core.browser.Browser.stop, add if self.connection: before close connection call.
# asyncio.get_running_loop().create_task(self.connection.send(cdp.browser.close()))
if self.connection:
asyncio.get_event_loop().create_task(self.connection.aclose())
logger.debug(
"closed the connection using get_event_loop().create_task()"
)
PS: util.deconstruct_browser() still contains a print statement at the end. It should be changed to logger.info.
Browser.start()
adds newly launched process in registered instances and then tries to connect to the browser. But in case of slow hardware or high system load, Chrome takes some time to response and nodriver throwsFailed to connect to browser
and exits.atexit handler
util.deconstruct_browser()
callsbrowser.stop()
while exiting but sincebrowser.connection
haven't initialized yet, it fails withAttributeError
. Leaving the running but unresponsive chrome in orphan state.Exception:
Fix:
In
nodriver.core.browser.Browser.stop
, addif self.connection:
before close connection call.PS:
util.deconstruct_browser()
still contains aprint
statement at the end. It should be changed tologger.info
.The text was updated successfully, but these errors were encountered: