Skip to content
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

[🐛 Bug]: logging to /dev/null remains dangling #12870

Closed
alexey-pelykh opened this issue Oct 5, 2023 · 2 comments · Fixed by #12871
Closed

[🐛 Bug]: logging to /dev/null remains dangling #12870

alexey-pelykh opened this issue Oct 5, 2023 · 2 comments · Fixed by #12871

Comments

@alexey-pelykh
Copy link
Contributor

What happened?

ResourceWarning: unclosed file <_io.BufferedWriter name='/dev/null'>

that's caused by a bug in the following lines of code:

if self.log_output != PIPE:
if isinstance(self.log_output, TextIO):
self.log_output.close()
elif isinstance(self.log_output, int):
os.close(self.log_output)

possibly this case is not covered:

elif log_output is None or log_output is subprocess.DEVNULL:
self.log_output = open(os.devnull, "wb")

likely was introduced in #12637

How can we reproduce the issue?

Launch the Chrome WebDriver via Selenium

Relevant log output

ResourceWarning: unclosed file <_io.BufferedWriter name='/dev/null'>


### Operating System

macOS

### Selenium version

Python 4.13.0

### What are the browser(s) and version(s) where you see this issue?

Chrome for Testing 117.0.5938.149

### What are the browser driver(s) and version(s) where you see this issue?

Chromedriver 117.0.5938.149

### Are you using Selenium Grid?

_No response_
@github-actions
Copy link

github-actions bot commented Oct 5, 2023

@alexey-pelykh, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@pujagani pujagani added the C-py label Oct 5, 2023
@titusfortner titusfortner added this to the 4.14 milestone Oct 5, 2023
aguspe pushed a commit to aguspe/selenium that referenced this issue Oct 22, 2023
The isinstance check was faulty and checked wrong type

Fixes SeleniumHQ#12870
Copy link

github-actions bot commented Dec 4, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants