jails which take a long time to shutdown

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

jails which take a long time to shutdown

Dan Langille
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.

--
Dan Langille - BSDCan / PGCon
[hidden email]



signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: jails which take a long time to shutdown

Ernie Luzar
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.
>
> --
> Dan Langille - BSDCan / PGCon
> [hidden email]
>
>

Using the halt command will cause jails to bypass an orderly shutdown
leaving databases with data in buffers never being written to the
database. A very big no no.  Use shutdown command always.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jails which take a long time to shutdown

James Gritton-2
In reply to this post by Dan Langille
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
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jails which take a long time to shutdown

Miroslav Lachman
In reply to this post by Dan Langille
Dan Langille wrote on 2019/02/06 16:47:
> 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.

Can it be related to calling /etc/rc.shutdown and sort
rcshutdown_timeout in rc.conf? (etc/defaults/rc.conf has
rcshutdown_timeout=90)

Is your mongodb corrupted when you just restart the jail or only in case
when you restart the whole machine? I am not sure if the system shutdown
will wait 90 for each jail or kill all processes after 90 seconds
counted by hosts rcshutdown_timeout.

Miroslav Lachman
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jails which take a long time to shutdown

Mark Blackman-4
In reply to this post by Dan Langille


> On 6 Feb 2019, at 15:47, Dan Langille <[hidden email]> 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.
>

Isn’t corrupted the natural state for a mongodb database? :)

- Mark

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"