-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Windows: Fix an issue where stopping the service immediately after startup could leave the processes #4782
Conversation
Signed-off-by: Daijiro Fukuda <[email protected]>
Test
BeforeThe supervisor and worker processes remain if stopping the service immediately after startup. Powershell $ Start-Service fluentdwinsvc; Stop-Service fluentdwinsvc
$ (ps -Name ruby).length
2 AfterThe supervisor and worker processes stop correctly if stopping the service immediately after startup. Powershell $ Start-Service fluentdwinsvc; Stop-Service fluentdwinsvc
$ (ps -Name ruby).length
0 |
Test: If max_retries(
|
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
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.
Fix itself seems LGTM.
There is a nitpick about naming.
Signed-off-by: Daijiro Fukuda <[email protected]> Co-authored-by: Kentaro Hayashi <[email protected]>
Signed-off-by: Daijiro Fukuda <[email protected]>
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.
Thanks for your review! |
…artup could leave the processes (#4782) **Which issue(s) this PR fixes**: * Fixes #3937 **What this PR does / why we need it**: Add retry for stop event for Windows Service to fix #3937. If `Event.open()` ([OpenEvent](https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-openeventw)) is called before the `Event.new()` ([CreateEvent](https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventw)), `Event.open()` raises `Errno::ENOENT`. This causes the service to be stopped while the supervisor and worker process remains. It causes #3937. This PR fixes it by adding retry. https://github.com/fluent/fluentd/blob/30c3ce00ff165b1b5d9f53fc0a027074bbcab0da/lib/fluent/winsvc.rb#L90 https://github.com/fluent/fluentd/blob/30c3ce00ff165b1b5d9f53fc0a027074bbcab0da/lib/fluent/supervisor.rb#L299 **Docs Changes**: Not needed. **Release Note**: It would be good to have both of the following. * Windows: Fixed an issue where stopping the service immediately after startup could leave the processes. * Windows: Fixed an issue where stopping service sometimes can not be completed forever. --------- Signed-off-by: Daijiro Fukuda <[email protected]> Co-authored-by: Kentaro Hayashi <[email protected]> Signed-off-by: Kentaro Hayashi <[email protected]>
…diately after startup could leave the processes (#4782) (#4802) **Which issue(s) this PR fixes**: Backport #4782 **What this PR does / why we need it**: Add retry for stop event for Windows Service to fix #3937. If `Event.open()` ([OpenEvent](https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-openeventw)) is called before the `Event.new()` ([CreateEvent](https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventw)), `Event.open()` raises `Errno::ENOENT`. This causes the service to be stopped while the supervisor and worker process remains. It causes #3937. This PR fixes it by adding retry. https://github.com/fluent/fluentd/blob/30c3ce00ff165b1b5d9f53fc0a027074bbcab0da/lib/fluent/winsvc.rb#L90 https://github.com/fluent/fluentd/blob/30c3ce00ff165b1b5d9f53fc0a027074bbcab0da/lib/fluent/supervisor.rb#L299 **Docs Changes**: Not needed. **Release Note**: It would be good to have both of the following. * Windows: Fixed an issue where stopping the service immediately after startup could leave the processes. * Windows: Fixed an issue where stopping service sometimes can not be completed forever. Signed-off-by: Daijiro Fukuda <[email protected]> Signed-off-by: Kentaro Hayashi <[email protected]> Co-authored-by: Daijiro Fukuda <[email protected]>
Which issue(s) this PR fixes:
What this PR does / why we need it:
Add retry for stop event for Windows Service to fix #3937.
If
Event.open()
(OpenEvent) is called before theEvent.new()
(CreateEvent),Event.open()
raisesErrno::ENOENT
.This causes the service to be stopped while the supervisor and worker process remains.
It causes #3937.
This PR fixes it by adding retry.
fluentd/lib/fluent/winsvc.rb
Line 90 in 30c3ce0
fluentd/lib/fluent/supervisor.rb
Line 299 in 30c3ce0
Docs Changes:
Not needed.
Release Note:
It would be good to have both of the following.