Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 Jan 2018 18:27:32 +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@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 224975
           Summary: shutdown(8) needs to wait longer for swapoff to avoid
                    a =E2=80=9CCannot allocate memory=E2=80=9D error
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: wosch@FreeBSD.org

While analysing the bug #224479 I noticed that `shutdown -r now=E2=80=99 ru=
ns to fast
and failed to swapoff a swap device or swap file.

I see on the console the error message:

  swapoff: /dev/md99: Cannot allocate memory

and soon later a kernel panic. Not good.

This happens when more swap space is in use than free memory is available. =
E.g.
you have 2.5GB swap space, 69MB are in use and only 49MB Free memory is
available (according to the top(1) command).

How to repeat:

# start some processes, which need a little bit more RAM than available
for i in $(seq 1 20);do perl -e '$a=3D`man tcsh`; for(0..100) { $b.=3D$a}; =
sleep
100' & done

top(1) reports:

Mem: 611M Active, 51M Inact, 112M Laundry, 142M Wired, 103M Buf, 49M Free
Swap: 2500M Total, 69M Used, 2431M Free, 2% Inuse


# now reboot with shutdown
$ shutdown -r now


you will see the =E2=80=9Cswapoff: /dev/md99: Cannot allocate memory=E2=80=
=9D error message
because 49M Free Mem is < than 69M used swap.

followed by a kernel swap_pager I/O error message

In case of low memory I think that shutdown/reboot needs to wait a little b=
it
(3..10 seconds) after we kill the processes. Then there will be enough free
memory available, and the swapoff call will run successfully.

--=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>