-
Notifications
You must be signed in to change notification settings - Fork 154
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
Beats shutdown issue #6875
Comments
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
The Elastic Agent calls proc.Kill where proc is There is no |
@blakerouse does it mean this is an expected behavior and not a bug? |
@jlind23 The behavior we have is clearly defined. I do believe there is an open question if we should use a different way of shutting down the process on Windows to ensure that the cleanups are ran. If the cleanup are not ran then it is a bug. The cleanups should be ran. |
The documentation for
It seems we need a more graceful way to shutdown the process, so all the cleanups actually run. As Blake mentioned, Windows does not support the interrupt, which makes things more complicated there. |
We could have the OpAMP is using https://learn.microsoft.com/en-us/windows/console/generateconsolectrlevent to send |
@bjmcnic Elastic Agent does tell the component to stop the unit. I would expect at that point it would cleanup. |
Indeed, there is some intent, but if the Elastic-Agent sends a kill signal (like here: https://github.com/elastic/elastic-agent/blob/main/pkg/core/process/cmd.go#L35) before the Beat has time to fully clean up/gracefully exit the issue still persists. |
Also, it's possible there's a bug in the way the Beat shuts itself down, or that it does it in a way that doesn't allow cleanup to happen. Cancelling the root context causing all in progress operations to abort, even the ones doing cleanup, for one possibility. |
I would expect this to be an issue on Windows for beats in general. If I was to start the beat and then stop it from command-line would it clean up? If I stop it from task manager would it clean up? If I stop it from service manager would it clean up? |
For confirmed bugs, please report:
* Setup the Microsoft DNS server
* Install Elastic Agent
* Add the Microsoft DNS Server Integration with defaults
* Stop the Elastic Agent service
* Notice the
Elastic-DNSServer-Analytical
ETW trace remainsThis is just a specific testable scenario that speaks to a potentially broader issue. The integration within the filebeat portion of the
agentbeat.exe
process has code to stop that trace upon the integration being stopped, but that code never runs when Agent stops. Additionally, the code does not run when Agent is left running, but the integration is removed.Through debugging, it's been observed during the Elastic Agent service stop that the
elastic-agent.exe
service process callsNtTerminateProcess()
upon theagentbeat.exe
process hosting the filebeat integration. Theagentbeat.exe
process does not itself run its cleanup code and cleanly exit.It would seem that IPC between the
elastic-agent.exe
process and the subordinateagentbeat.exe
process is not occurring in a way to trigger clean shutdowns, at least in this instance.The text was updated successfully, but these errors were encountered: