A way to synchronously shutdown a ManagedProcess

Description

Would it be possible to have a shutdown on ManagedProcess that is not Asynchronous. I want to ensure Supervisor children are dying before I exit, probably a variant where we can decide a Shutdown Timeout?

Environment

None

Activity

Show:
Anonymous
April 21, 2015, 3:59 AM

asics running
asics singapore website http://asicssg.underthesunstudios.net/

Tim Watson
December 16, 2013, 11:10 AM

Thanks , I'll attend to those issues. You're right on both counts.

Tavis Rudd
December 15, 2013, 8:45 PM

Btw, the docs in ManagedProcess.hs, ManagedProcess/Server.hs and ManagedProcess/Server/Restricted.hs still refer to terminateHandler. I assume this is meant to be shutdownHandler now.

Also the docs in Client.hs on line 59 say "If responsiveness is important, a better approach might be to send an /exit signal/ with 'Shutdown' as the reason." Should that be 'ExitShutdown' as a reason?

Román González
December 13, 2013, 6:33 PM

Yes,

I think your first suggestion is exactly what we need, didn't know why we didn't come up with that.

Cheers.

Tim Watson
December 13, 2013, 11:09 AM

On further consideration, the code I posted above is the only way to synchronously stop a managed process - admittedly you could use exit pid reason instead of calling shutdown pid but regardless - since monitoring is the only way to detect the process' death. After all, the process can't reply that it is now dead whilst it is still alive, and doing so before it exits would be a potential race: a process replying with "I am finished/stopped" might get stuck trying to exit (or de-prioritised by the RTS scheduler before terminating), at which point any assumption that it has really died - e.g., trying to register some other process with the same name - would fail.

Assignee

Tim Watson

Reporter

Román González

Labels

None

External issue ID

None

OS

None

Components

Priority

Highly Desirable