-
Notifications
You must be signed in to change notification settings - Fork 11
Description
As-is, the implementation doesn't optimally address the use-case where this is being used as the entrypoint in a Docker container, to run bash in order to run a typical entry-point script, which then in turn starts processes.
As-is, if we wanted to allow two minutes to shut down (in my case, there could be a lot of work that needs completing), we would first have to wait 2 minutes for nothing to happen when it sends the sigterm to bash, after which pid1 finally sends the sigterm to bash's children and waits up to another 2 minutes for them to stop cleanly. If this is running in AWS, you'll never stop cleanly because the ECS stop timeout is 2 minutes, after which it does a sigkill.
In order to not break backwards compatibility, I would like to request the addition of a separate, optional timeout for either the parent or children, where, if not specified, the current --timeout value applies to both.
For example, by adding a --child-timeout parameter:
- No timeout specified sets a default timeout of 5 seconds for parent and 5 seconds for child -- no functional change.
- --timeout=10 sets a timout of 10 seconds for parent and 10 seconds for child -- no functional change.
- --child-timeout=120 lets the parent timeout default to 5 seconds, but will wait up to 120 seconds after sending sigterm to the children for all children to complete.
- --timeout=20 --child-timeout=120 sets the parent timeout to 20 seconds, but will wait up to 120 seconds after sending sigterm to the children for all children to complete.
- --timeout=0 --child-timeout=120 sets the parent timeout to 0 seconds, but will wait up to 120 seconds after sending sigterm to the children for all children to complete.
You could also instead (or additionally) have a new --parent-timeout, where, for example:
- --parent-timeout=120 sets the parent timeout to 120 seconds, and then will wait the default of up to 5 seconds after sending sigterm to the children for all children to complete.
- --timeout=120 --parent-timeout=1 sets the parent timeout to 1 seconds, and then will wait up to 120 seconds after sending sigterm to the children for all children to complete.
Etc.
If I knew Haskell, I'd make the change myself and submit it, but alas, I do not, and don't really have the time to learn another language I'd probably never use again.