Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 119007 - dont `swapoff` at shutdown
Summary: dont `swapoff` at shutdown
Status: RESOLVED LATER
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-14 10:59 UTC by roma1390
Modified: 2006-01-15 03:38 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description roma1390 2006-01-14 10:59:41 UTC
There is some situation, when remote reboot can't be completed.

True story:

1. it was a buggy kernel driver and eat almmost all memory and a lot of swap.
2. I was lucky, and loged into this machine remotly over ssh.
3. ram about 256 Mb, swap about 512 Mb. swap and ram usage over 90%.
4. Memory leak was inside kernel.
5. in reboot sequence was called swapoff.
6. OOM - killer wake up and killed reboot script/process
7. reboot stoped.

The only way to bring this machine back was hardware manual non-distance reset.
This isn't acceptible.

I suggest: don't swap off, if there isn't enougth memory to continue.
Better kill yourself (reboot process). less pain.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-01-14 11:08:58 UTC
I really don't see what we could do about this. We definitely won't "fix" OOM killer. :=) Assigning to baselayout if they have any ideas.
Comment 2 roma1390 2006-01-14 12:02:58 UTC
The questions is: 
1. it is realy important to off swap?
2. this situation can be detected and one of following steps made:
 a) continue with swap on
 b) try kill more proceses/free more memory and retry
 c) call /sbin/reboot -f

i prefer c option.
Comment 3 SpanKY gentoo-dev 2006-01-14 18:25:35 UTC
if there was a way to determine whether it was safe to leave the swap files activated, we may disable the call to `swapoff` ... but there isnt

swapfiles can be loop mount devices whose backing file is on a partition that is supposed to be unmounted, or it could be a network device that would cause a hang when the network interfaces are shut down
Comment 4 roma1390 2006-01-15 03:20:13 UTC
I understand that this situation isn't easy. But is better to
have some of helper to avoid it.

There can be many off scenarios when this situation occurs.
It is leak in kernel space or in user space too. 
Let say we have big process which have eaten a lot of memory but isn't killable
becouse:
1) have nfs job, but nfs are gone away.
2) working with buggy kernel drivers and are locked inside of it(read/write/ioctl)

You can't kill thease proceses. But they can use a lot of memory.

The worst thing is that you can't reboot your system from remote.
If this is, then means that Gentoo isn't server distribution... :(


The way to determine that there is enougth memory after disabling swap:
used memory + memory used in swap + minimum free space < total memory

if we can't disable swap, then we can do simply: reboot.

it is posible to first disable these swap partitions which are
1) on network
2) on file
3) on partition
Comment 5 SpanKY gentoo-dev 2006-01-15 03:38:42 UTC
feel free to post a patch to implement said functionality