From owner-freebsd-bugs@freebsd.org Mon Jan 30 13:14:14 2017 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 0F456CC7F27 for ; Mon, 30 Jan 2017 13:14:14 +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 mx1.freebsd.org (Postfix) with ESMTPS id D8F8D12BF for ; Mon, 30 Jan 2017 13:14:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v0UDEDwW072445 for ; Mon, 30 Jan 2017 13:14:13 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 210315] panic: destroying non-empty racct: 2113536 allocated for resource 4 Date: Mon, 30 Jan 2017 13:14:14 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: avg@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: Message-ID: In-Reply-To: References: 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.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2017 13:14:14 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D210315 --- Comment #11 from Andriy Gapon --- (In reply to Edward Tomasz Napierala from comment #8) Yes, that must be true. It is impossible to get that problem for the proce= ss racct. I have one hypothesis now. Consider the following sequence of events: 0. the vm daemon gets a reference on a vm space of a process 1. the vm daemon invokes the first racct_set(p, RACCT_RSS, rsize) call for = the process 2. the process exits and vmspace_exit() is called for the the vm space 3. the vm daemon calls racct_set(p, RACCT_RSS, rsize) within if (rsize > ravailable) block 4. the vm daemon releases the vm space I think that in this scenario we would do the following: 1. set RACCT_RSS of the process to X 2. set RACCT_RSS of the process to zero 3. set RACCT_RSS of the process (now a zombie) to Y I think that that last call would screw up the accounting for raccts that include the process. In fact, it also screws up the accounting for the pro= cess itself, but that is masked by the code in racct_proc_exit() that sets to ze= ro all reclaimable resources. Ah, and because of what racct_proc_exit() does, we have this: 4. set RACCT_RSS of the process (now a zombie) to zero So, it looks like only the jail accounting is affected and we see it only in the window between exit1() dropping the reference to the jail and proc_reap= (). So, to recap, the full sequence: 0. the vm daemon gets a reference on a vm space of a jailed process 1. the vm daemon invokes the first racct_set(p, RACCT_RSS, rsize) call for = the process 2. the process exits and vmspace_exit() is called for the the vm space 3. the vm daemon calls racct_set(p, RACCT_RSS, rsize) within if (rsize > ravailable) block 4. the vm daemon releases the vm space 5. the process drops its reference to the jail 6. the jail gets destroyed <-- here we hit the problem I think that the above could explain the panics that I saw. Not sure if the Larry's panic can be fit into the hypothesis. --=20 You are receiving this mail because: You are the assignee for the bug.=