From owner-freebsd-questions@freebsd.org Sat Jun 2 23:25:33 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 4D151FF6806 for ; Sat, 2 Jun 2018 23:25:33 +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 E835880588 for ; Sat, 2 Jun 2018 23:25:32 +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 6208421908; Sat, 2 Jun 2018 19:25:32 -0400 (EDT) Received: from web3 ([10.202.2.213]) by compute7.internal (MEProxy); Sat, 02 Jun 2018 19:25:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=W8VlrL KTA/BcbCqVHWpFnlxSSkgl2EbntHbMQeb2/Bc=; b=IEzH06b5ImK87/igzVyA0X vxAa9Nh5bU/jl2fsuJ0XW4MjNTnzzL3BzPc9eyTuqIsafVCXV1I9aLc7Y9u+gS3h 3DgVXlL8hAA82Aa3wJ9TtUNnRRl7eywYeXKkWbuNfJqlqdukaGeyCJUGNEOfr49/ vvkN4L9TR3noKQZTA61r/YIpor/SoteR1EzHBTO0hpVDWrmfd9OnbNAANJ2ihF/j 43B/A7Pz7WRO3/+a76XJl8TeBPDF2WYkF1pZUZAGf6edpDi8rHQ4hyS+bVCHRigI JHsPVyQZTnHD9NTS/CcozNmUDIjyynQJ2yv2U8cq2n9YcOAAGF8GGiEnX2km19gQ == 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 0287D9E382; Sat, 2 Jun 2018 19:25:31 -0400 (EDT) Message-Id: <1527981931.2670335.1394316280.09410FC9@webmail.messagingengine.com> From: Brennan Vincent To: John Howie Cc: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-397f98d6 Date: Sat, 02 Jun 2018 19:25:31 -0400 References: <1527977770.2651378.1394286400.0806CC5C@webmail.messagingengine.com> <01EE7EEA-03AC-4D71-BA08-B0CEA97EE720@thehowies.com> Subject: Re: Is it normal that a user can take down the whole system by using too much memory? In-Reply-To: <01EE7EEA-03AC-4D71-BA08-B0CEA97EE720@thehowies.com> 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 23:25:33 -0000 Thanks John for the response -- this should help me solve my practical need= s. I'm also curious, however, to learn more from an OS design perspective. Why= isn't it possible for the kernel to realize it should kill `eatmem` rather= than make the system unusable? Is this a hard problem in general, or just a missing feature in FreeBSD spe= cifically ? On Sat, Jun 2, 2018, at 6:40 PM, John Howie wrote: > Hi Brennan, >=20 > Do =E2=80=98man -k limit=E2=80=99 for details of means to restrict resour= ce consumption.=20 > In particular, check out limits(1) and rctl(8). >=20 > Variations of this problem have been around forever. An oldie but goldie = is: >=20 > main () { while (1) { fork (); } } >=20 > I cannot say why you are getting the results you see on your specific=20 > system. I would check limits to see where they are set, and tweak them. >=20 > Cheers, >=20 > John >=20 >=20 >=20 >=20 > Sent from my iPhone >=20 > > On Jun 2, 2018, at 15:20, Brennan Vincent wrot= e: > >=20 > > The attached program `eatmem.c` is a simple example to waste N gigs of = memory as quickly as possible. > >=20 > > 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. H= owever, 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 whe= never it tries to run). The only way to recover is by rebooting. > >=20 > > Is this expected behavior? > >=20 > > 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. > > > > _______________________________________________ > > freebsd-questions@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd= .org"