From owner-freebsd-questions@freebsd.org Sat Jun 2 22:16:18 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F353FEEA36 for ; Sat, 2 Jun 2018 22:16:18 +0000 (UTC) (envelope-from brennan@umanwizard.com) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E36D57B99B for ; Sat, 2 Jun 2018 22:16:17 +0000 (UTC) (envelope-from brennan@umanwizard.com) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 4E1E520D97 for ; Sat, 2 Jun 2018 18:16:11 -0400 (EDT) Received: from web3 ([10.202.2.213]) by compute7.internal (MEProxy); Sat, 02 Jun 2018 18:16:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=Dk3LtsLaXuQoX9rr+h4089Pi0lmSt gDglleNx6QDfBE=; b=hNlPJ/VgDnlX1hxYt8tqYtRweJQnt0jqpKMj0LnDgOWA+ ZIgw+Ot2AkpKtbRDk9cnbenkbPPHmLI9hyA9nFvDBjI1uYvlDNRPEqCMIbu4AwaC bBkYdTSDPTRVG8FwjHwwmI2HCYzZM9F4m4sh908n65TSelQjQ15zJGYY0uQ6YVVw E+stdlk/n9aIVpBpfCoO7Z2Y3yn8iZ9U6hdkUYnde9dDsSNNAFqgu1F9qhvZRgno DAfi/PMq69HbLdIOCh74k3soBKDLZ8a2Thk2P8v0eaFEpaBI0azUyqo7td+ATn1s NraE8PT1H1zVHIS1eXTqVIjuRD+ERNHeQiH5ahMcg== X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: by mailuser.nyi.internal (Postfix, from userid 99) id F2B639E382; Sat, 2 Jun 2018 18:16:10 -0400 (EDT) Message-Id: <1527977770.2651378.1394286400.0806CC5C@webmail.messagingengine.com> From: Brennan Vincent To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_152797777026513781" X-Mailer: MessagingEngine.com Webmail Interface - ajax-397f98d6 Subject: Is it normal that a user can take down the whole system by using too much memory? Date: Sat, 02 Jun 2018 18:16:10 -0400 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 22:16:18 -0000 This is a multi-part message in MIME format. --_----------=_152797777026513781 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" The attached program `eatmem.c` is a simple example to waste N gigs of memory as quickly as possible. When I run something like `eatmem 32` (on a system with less than 32GB of RAM), about half the time everything works fine: the system quickly runs out of RAM and swap, the kernel kills `eatmem`, and everything recovers. However, the other half of the time, the system becomes completely unusable: my ssh session is killed, important processes like `init` and `getty` are killed, and it's impossible to even log into the system (the local terminal is unresponsive, and I can't ssh in because sshd is killed immediately whenever it tries to run). The only way to recover is by rebooting. Is this expected behavior? My system details are as follows: FreeBSD 12 CURRENT x86_64 guest on VMWare Fusion. ram: 8 GB swap: 1 GB Host: macbook pro running macOS. --_----------=_152797777026513781 Content-Disposition: attachment; filename="eatmem.c" Content-Id: <1527977409.2650163.6e127ffd81b5cf25772b7b863610084a2a170cfd.6AAE3585@content.messagingengine.com> Content-Transfer-Encoding: base64 Content-Type: text/plain; name="eatmem.c" I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCiNkZWZp bmUgUEFHRV9TSVpFIDQwOTYKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiph cmd2KQp7CglzaXplX3QgZ2IgPSBhdG9pKGFyZ3ZbMV0pOwoJc2l6ZV90IHN6 ID0gZ2IgKiAxMDI0ICogMTAyNCAqIDEwMjQ7Cgl2b2xhdGlsZSBjaGFyICpt ZW0gPSBtYWxsb2Moc3opOwoJaWYgKCFtZW0pIHsKCQlmcHJpbnRmKHN0ZGVy ciwgIkNvdWxkbid0IG1hbGxvYyFcbiIpOwoJCXJldHVybiAtMTsKCX0KCXdo aWxlICgxKQoJCWZvciAoc2l6ZV90IGkgPSAwOyBpIDwgc3o7IGkgKz0gUEFH RV9TSVpFKQoJCQltZW1baV0gPSAwOwp9Cg== --_----------=_152797777026513781--