-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[py] service: only shutdown if process not terminated #15183
base: trunk
Are you sure you want to change the base?
Conversation
There are scenarios where a stop() is called on a Service object multiple times. This also happens when explicitly quitting a Webdriver using driver.quit() and afterwards having the garbage collector destroy the service object, calling stop() another time even though the service process has already terminated. The check inside the stop() call only ensured that the process variable is not None, but ignored the fact that the process might already have terminated. Therefor an additional check is introduced to only send the remote shutdown command if the service process has not ended. Fixes SeleniumHQ#15182 Signed-off-by: Sandro Pischinger <[email protected]>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
@shbenzer can you take a look once? |
Will add more details and information in the issue thread. Even if the delayed termination cannot be reproduced (yet), this PR still includes an improvement. When trying to reproduce the described behavior you will be able to observe that the "shutdown" request is sent twice: once when calling |
User description
There are scenarios where a stop() is called on a Service object multiple times. This also happens when explicitly quitting a Webdriver using driver.quit() and afterwards having the garbage collector destroy the service object, calling stop() another time even though the service process has already terminated.
The check inside the stop() call only ensured that the process variable is not None, but ignored the fact that the process might already have terminated. Therefor an additional check is introduced to only send the remote shutdown command if the service process has not ended.
Motivation and Context
Fixes #15182
Types of changes
Checklist
PR Type
Bug fix
Description
Added a check to ensure the service process has not terminated before sending a shutdown command.
Prevented redundant shutdown attempts when
stop()
is called multiple times.Improved robustness of the
stop()
method in theService
class.Changes walkthrough 📝
service.py
Added process termination check in `stop()` method
py/selenium/webdriver/common/service.py
using
poll()
.terminated.