Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 Jan 2018 21:19:50 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   =?UTF-8?B?W0J1ZyAyMjQ5NzVdIHNodXRkb3duKDgpIG5lZWRzIHRvIHdhaXQg?= =?UTF-8?B?bG9uZ2VyIGZvciBzd2Fwb2ZmIHRvIGF2b2lkIGEg4oCcQ2Fubm90IGFsbG9j?= =?UTF-8?B?YXRlIG1lbW9yeeKAnSBlcnJvcg==?=
Message-ID:  <bug-224975-8-NbiEFv7a2C@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-224975-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-224975-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D224975

Jilles Tjoelker <jilles@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jilles@FreeBSD.org

--- Comment #1 from Jilles Tjoelker <jilles@FreeBSD.org> ---
Just "waiting for a few seconds" will not help. The order of operations wou=
ld
have to be adjusted. The current order is (incomplete):

 * shutdown(8) prints final warning message
 * shutdown(8) signals init(8)
 * init(8) sends SIGHUP to all /etc/ttys session leaders and revokes the
terminals
 * init(8) starts rc.shutdown
 * rc.shutdown shuts down some daemons
 * rc.shutdown runs /etc/rc.d/swaplate, turning off swap with the late flag
 * rc.shutdown shuts down other daemons
 * init(8) revokes /dev/console
 * init(8) signals all processes with SIGTERM and then SIGKILL, waiting up =
to
20 seconds for them to terminate
 * init(8) calls reboot(2) with appropriate arguments
 * kernel syncs
 * kernel unmounts (forcibly) all filesystems
 * kernel turns off all swap
 * kernel instructs hardware to power off, reboot, etc.

As a result, any swap files must be turned off by /etc/rc.d/swaplate. If no=
t,
the kernel will panic when trying to read data from the swap file when turn=
ing
it off, since the filesystems have already been unmounted.

You can make scenarios like yours work (without changes to FreeBSD) if you
ensure the memory-eating processes are either shut down by an rc.d script t=
hat
runs before swaplate in the shutdown order or are in the foreground of a tty
which is enabled in /etc/ttys.

What could be done in FreeBSD is adding unforced unmount and swapoff after =
all
processes have been signaled. This could be in init(8) or the kernel. Some
looping may be beneficial since turning off a swap file may make it possibl=
e to
unmount a filesystem without forcing.

In case of swap on fuse or the like, it is necessary to turn off the swap
before stopping the fuse daemon. However, it is best to kill as many proces=
ses
as possible before turning off swap to avoid paging in useless things and to
avoid high memory pressure.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-224975-8-NbiEFv7a2C>