-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A socket ResourceWarning in Selenium Python WebDriver #6878
Comments
the line you are referring to is only conditionally called when
so wouldn't your suggestion to call I don't think you can have it both ways. If you use keep-alives, a byproduct is that you may leave open connections. or am I missing something? |
You need to call |
can u submit a PR? |
I have created a PR for this: #6941 |
A fix for: #6878 When the ‘keep alive’ option is enabled the remote_connection object will create a PoolManager, but never deliberately clear it. This can cause ResourceWarning warnings from open sockets. Added a new "close()" function which explicitly clears the pool. This close function is called from Webdriver's “quit()” function (+1 squashed commit)
This appears to have been fixed so closing |
A fix for: SeleniumHQ/selenium#6878 When the ‘keep alive’ option is enabled the remote_connection object will create a PoolManager, but never deliberately clear it. This can cause ResourceWarning warnings from open sockets. Added a new "close()" function which explicitly clears the pool. This close function is called from Webdriver's “quit()” function (+1 squashed commit)
Seems like this only fix the issue while keep_alive = True, then how about when keep_alive=False i saw the same issue |
Good catch. It looks like a separate I can make a similar PR for this. |
Fixes SeleniumHQ#6878 This is meant to solve ResourceWarning messages when WebDrivers are instanced with a KeepAlive=False.
Fixes #6878 This is meant to solve ResourceWarning messages when WebDrivers are instanced with a KeepAlive=False.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes SeleniumHQ#6878 This is meant to solve ResourceWarning messages when WebDrivers are instanced with a KeepAlive=False.
Fixes SeleniumHQ#6878 This is meant to solve ResourceWarning messages when WebDrivers are instanced with a KeepAlive=False.
🐛 Bug Report
You get a
ResourceWarning
for a socket from Selenium Python WebDriver.To Reproduce
Save as "resourcewarning.py":
And run it:
Expected behavior
I expect this script to exit with no output, but it spits out a
ResourceWarning
.Analysis
This is caused by not calling
clear
on theurllib3.PoolManager
created at:selenium/py/selenium/webdriver/remote/remote_connection.py
Line 140 in cac262f
Environment
OS: Windows 10.0.17763.253 x64
Browser: Firefox
Browser version: 64.0.2 (64-bit)
Browser Driver version: GeckoDriver 0.23.0
Language Bindings version: Python 3.141.0
The text was updated successfully, but these errors were encountered: