cli
cli copied to clipboard
[Proposal] `dapr stop` should wait until process actually exits
Describe the proposal
Currently the dapr stop command executes a kill command (or equivalent, for Windows) to stop a dapr or daprd process. However, this is asynchronous; the process may still take some time to actually exit. Scripts or other tooling that use the dapr stop command may have an expectation that, upon completion of dapr stop, processes have actually exited.
dapr stop should ensure that the process has exited before the command itself exits (within a suitable or perhaps configurable timeout).
Release Note
RELEASE NOTE:
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.
I think adding a --wait,-w flag for stop with a default timeout will be good. Additionally, after the configured timeout, the process should be checked again to make sure it has exited.
/assign
So the ideal solution here would be a --wait flag (along with other flags like run-file) with a default timeout of say, 30 seconds? (please feel free to suggest a better value). Once this time has passed, the process should be checked to confirm if they have been successfully killed. In either case, whether they have been killed or not, we just log the status and go ahead with the completion of dapr stop?
maybe slightly less for the default value? like 15 seconds but otherwise I think sounds good IMO
@nikitasarawgi to my understanding:
- When
dapr stopis invoked, it should send a SIGTERM to the app (like it does today) - It then waits for the app to exit cleanly
- If the app doesn't exit cleanly within the timeout defined in
--wait, then the Dapr CLI forcefully kills the process (SIGKILL)
See SIGKILL vs SIGTERM: https://askubuntu.com/a/481173
maybe slightly less for the default value? like 15 seconds but otherwise I think sounds good IMO
+1 on 15 sec
Hi @nikitasarawgi, I agree the --wait flag is a good way to solve this. The flow described by ItalyPaleAle makes sense.