Bug#805133: systemd disables swap too early during shutdown
Ron
ron at debian.org
Sun Nov 15 05:02:12 GMT 2015
Package: systemd
Version: 215-17+deb8u2
Severity: important
Hi,
On a normal shutdown or reboot, systemd disables swap before stopping
any other processes. I see something like this:
Nov 15 14:50:53 systemd[1]: Started Synchronise Hardware Clock to System Clock.
Nov 15 14:50:53 systemd[1]: Deactivating swap /dev/disk/by-uuid/bffdb4e8-...
Nov 15 14:50:53 systemd[1]: Deactivating swap /dev/disk/by-uuid/bffdb4e8-...
Nov 15 14:50:53 systemd[1]: Deactivating swap /dev/disk/by-uuid/bffdb4e8-...
Nov 15 14:50:53 systemd[1]: Stopping system-ifup.slice.
Nov 15 14:50:53 systemd[1]: Removed slice system-ifup.slice.
Nov 15 14:50:53 systemd[1]: Stopping <all other services>
Which is fairly undesirable, because processes wanting to do a clean
shutdown may need to allocate memory, and they are now competing for
it with the thundering herd of all the processes that have just been
signalled to shutdown simultaneously.
I noticed this because it was in fact causing postgres to OOM on a test
system as it tried to checkpoint itself while doing an orderly shutdown.
I'm tempted to call this 'grave', because the potential for data loss is
about the equivalent of just yanking the power cord out of the wall for
every shutdown - and in the case of postgres on this system it indeed
means that the WAL segment files are not properly archived before the
system is shutdown - which would be real data loss if anything tried to
restore from them before this system was restarted again.
This really should delay disabling swap until about the last thing it
does before actually halting - and it should probably only disable it
once, since the repeating of that 3 times seems like a bug in its
handling of this too.
Cheers,
Ron
More information about the Pkg-systemd-maintainers
mailing list