v2.3: validator: Add --wait-for-exit flag to exit subcommand (backport of #6780) #6908
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Copied from #6233
Currently,
agave-validator
exit will return immediately when theAdminRpc
function call returns, even though the actual validator process might still be running. This isn't ideal if someone is trying to do something like:Summary of Changes
pid
method toAdminRpc
interface--wait-for-exit
flag option toexit
subcommandPID
from a running validator, initiating exit (same as before) and then using waiting until the returned PID is no longer alivePrevious Attempt
This change was previously introduced in #6233; however, there was a minor issue discoverd that affects upgrade scenarios. Namely, if a "new"
agave-validator
binary (one that callspid()
) is used to exit an "old"agave-validator
(one that predates this change), it would error out since the old bin wouldn't recognize thepid()
request.This is mitigated by calling
pid()
BUT only checking the result if using--wait-for-exit
. Since the new flag is opt-in, it seems more reasonable to expect that someone who opted in to a new feature would keep an eye on it. Once a version with this change is widely adopted,pid()
will be available and more direct error handling will work just fineSince this is re-adding a reverted commit, I left the original two commits as-is and added a third commit for the change in behavior. Hopefully this makes things easier for folks who might have previously reviewed this change
This is an automatic backport of pull request #6780 done by Mergify.