[Elastic Agent] Add ability to re-exec agent#20111
[Elastic Agent] Add ability to re-exec agent#20111blakerouse merged 5 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
💔 Tests FailedExpand to view the summary
Build stats
Test stats 🧪
Test errorsExpand to view the tests failures
--------------------- >> end captured stdout << ----------------------
Steps errorsExpand to view the steps failures
Log outputExpand to view the last 100 lines of log output
|
There was a problem hiding this comment.
do we need to handle case when service is set to auto-restart?
There was a problem hiding this comment.
It does handle this case, by checking the service.ProcessId with the previous servicePid. When the command is called the previous pid is sent in the arguments to the command. Inside the loop it checks if the service is stopped (if so it starts it, and exits) if its not stopped it checks the current service.ProcessId against the previous pid and if it is different then it means it was already restarted so we also exit.
|
CI failures are unrelated to this PR. |
* Add ability to reexec on all platforms. * Get it working on Windows * Fix on mac. * Fix vet. * Update ShutdownChan to be receive only. (cherry picked from commit 5a37193)
* Add ability to reexec on all platforms. * Get it working on Windows * Fix on mac. * Fix vet. * Update ShutdownChan to be receive only.
What does this PR do?
This adds the ability to re-exec Elastic Agent in the same PID and memory address space (on unix) and with in the same service on Windows (not same PID and address space).
This has been tested on Windows using
SIGINTand Windows services, but theSIGINTcatch is removed in the PR because it cannot be that way truly. Adding a way to perform this on Windows will occur in a follow up branch.Why is it important?
This is one of the steps to self-upgrading the Elastic Agent. This will also be used to allow reloading of the Elastic Agent when a configuration change that does not automatically get applied through the reloader.
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added tests that prove my fix is effective or that my feature works(very hard to unit test)[ ] I have added an entry inCHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Author's Checklist
SIGHUPto process will perform shutdown of the application and the re-exec itself.How to test this PR locally
Start the
elastic-agentthen send SIGHUP.