From owner-freebsd-bugs@freebsd.org Sun Jan 7 18:27:32 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DDC9E79BF5 for ; Sun, 7 Jan 2018 18:27:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 547F872135 for ; Sun, 7 Jan 2018 18:27:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 49CBD1FF3F for ; Sun, 7 Jan 2018 18:27:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w07IRWGi034082 for ; Sun, 7 Jan 2018 18:27:32 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w07IRW9s034081 for freebsd-bugs@FreeBSD.org; Sun, 7 Jan 2018 18:27:32 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: =?UTF-8?B?W0J1ZyAyMjQ5NzVdIHNodXRkb3duKDgpIG5lZWRzIHRvIHdhaXQg?= =?UTF-8?B?bG9uZ2VyIGZvciBzd2Fwb2ZmIHRvIGF2b2lkIGEg4oCcQ2Fubm90IGFsbG9j?= =?UTF-8?B?YXRlIG1lbW9yeeKAnSBlcnJvcg==?= Date: Sun, 07 Jan 2018 18:27:32 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: wosch@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 18:27:32 -0000 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.=