-
-
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
Closing out logging on quit #12637
Closing out logging on quit #12637
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The biggest problem is that not all log_output
instances respond to close()
. It can be used to set STDOUT or STDERR which are actually int
What if we move it to the Service class's close()
method and put in a conditional so that it works for log file, stdout or null?
Hi Titus, my latest commit should close log_output if it's set to an int like you said. Sorry, but I'm not sure what you meant when you said move it to the server class' close method, could you clarify that if there's still an issue with the commit? Thanks! |
oops, sorry, I meant the This logic would apply to all the service classes, not just Firefox. |
a840ddc
to
ec2a36d
Compare
ec2a36d
to
0eab6cb
Compare
Ok, I moved your solution to the stop method. There was already logic there, but I don't think it was doing the right thing. @isaulv can you double check us on this change? I think the issue is that devnull needs to be closed and we were ignoring it before. Also not sure what previous code was rescuing; should I keep that just in case? |
@titusfortner I think the proposed code is correct. It will close open files (TextIO) and if it's a file descriptor like stdout or stdin, os.close should handle that file descriptor, and even dev/null. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov ReportPatch coverage:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## trunk #12637 +/- ##
==========================================
- Coverage 57.02% 57.01% -0.02%
==========================================
Files 86 86
Lines 5322 5325 +3
Branches 192 192
==========================================
+ Hits 3035 3036 +1
- Misses 2095 2097 +2
Partials 192 192
☔ View full report in Codecov by Sentry. |
Thanks @Sean-Gomez |
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
The line I added closes out the log file connections before the service performs a full shutdown
Motivation and Context
A project I'm working on uses the Selenium webdriver and I noticed unclosed sockets remained in some of our unit tests, which could potentially affect performance. This addition should now properly close the open sockets of the log output file process.
Types of changes
Checklist