jails which take a long time to shutdown
James Gritton
jamie at freebsd.org
Wed Feb 6 17:43:29 UTC 2019
On 2019-02-06 08:47, Dan Langille wrote:
> Michael,
>
> Something came to mind with your recent post about exit codes.
>
> What if a jail takes minutes to shutdown? Will it be shutdown
> properly?
>
> I ask because I routinely have a jail which when restarted has a
> corrupted mongodb database.
>
> I have not tracked down the issue, but I know it takes a while to
> shutdown.
There are two jail parameters that work will effect that.
"exec.timeout" sets a limit that jail(8) will wait for a command such as
rc.shutdown to complete. Setting this may cause your jail to fail to
stop - at least as far as jail(8) knows. The command will still be
running, and rc.shutdown may or may not eventually complete, and then
the jail may then go away on its own if "persist" isn't set. Not
setting it will make jail(8) sit and wait for an indefinite time.
"stop.timeout" sets a limit that jail will wait after successful
completion of the stop scripts, between sending everything a SIGTERM and
removing the jail outright (which will send then a SIGKILL from the
kernel). It has a default of ten seconds, but may be set to zero in
which case it's straight to removal and SIGKILL.
In addition to these, there's rc.shutdown's $rcshutdown_timeout. It
would make sense to set exec.time to at least this long (default 90
seconds) if you use it at all.
So if your desire is to protect database integrity over getting a known
shutdown time, keep exec.timeout unset and change $rcshutdown_timeout to
"". Then jail -r should patiently wait.
- Jamie
More information about the freebsd-jail
mailing list