From owner-svn-src-all@freebsd.org Wed Jun 17 16:39:52 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07541353807; Wed, 17 Jun 2020 16:39:52 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49n9lW6RYQz42nb; Wed, 17 Jun 2020 16:39:51 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id CED6E1E799; Wed, 17 Jun 2020 16:39:51 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f178.google.com with SMTP id q14so2008669qtr.9; Wed, 17 Jun 2020 09:39:51 -0700 (PDT) X-Gm-Message-State: AOAM530Jzq3nHgljP0eX45yZxrIphecsgcb7mfuHauG5X9jVa4fvIm6c /ZZr0Gv99AkpUh6ARa6zqBT49FW5Gq1GvkOkCGk= X-Google-Smtp-Source: ABdhPJzL62bIhI5mL5lfmjOYw+tJ2QRLLoiSZXC/RYR2ZWiS/bCWgO7q/fLVGPua2A4ij5jhXzOjEd9A3y/E4li+/fA= X-Received: by 2002:ac8:311d:: with SMTP id g29mr28484268qtb.242.1592411991315; Wed, 17 Jun 2020 09:39:51 -0700 (PDT) MIME-Version: 1.0 References: <202006091517.059FHNS9050196@repo.freebsd.org> In-Reply-To: From: Kyle Evans Date: Wed, 17 Jun 2020 11:39:38 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r361967 - head/sys/kern To: Mateusz Guzik Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2020 16:39:52 -0000 On Wed, Jun 17, 2020 at 10:21 AM Mateusz Guzik wrote: > > pho@ reported triggering one of the asserts: > https://people.freebsd.org/~pho/stress/log/mjguzik028.txt > > I did not have the time to properly investigate this yet and this does > not reproduce for me. > Ah, this is good to know that he's reproduced it. There's only so many places that we touch these. I can't quite envision how, but the only scenario this would seem to be possible in is doenterpgrp() -> fixjobc(p, p->p_grp, 0) -> adjusts some child with a different process group without actually changing it, orphans the group, then we manage to finalize killjobc() on a freshly-orphaned process, which hasn't had its p_pgrp nullified. I haven't yet traced it through completely enough to determine if there's any way that can even happen. > That said, I may either revert the assert (or degrade to a warning) or > add some commentary if I don't sort this out this week. > > On 6/17/20, Kyle Evans wrote: > > On Tue, Jun 9, 2020 at 10:17 AM Mateusz Guzik wrote: > >> > >> Author: mjg > >> Date: Tue Jun 9 15:17:23 2020 > >> New Revision: 361967 > >> URL: https://svnweb.freebsd.org/changeset/base/361967 > >> > >> Log: > >> Assert on pg_jobc state. > >> > >> Stolen from NetBSD. > >> > >> Modified: > >> head/sys/kern/kern_proc.c > >> > >> Modified: head/sys/kern/kern_proc.c > >> ============================================================================== > >> --- head/sys/kern/kern_proc.c Tue Jun 9 14:20:16 2020 (r361966) > >> +++ head/sys/kern/kern_proc.c Tue Jun 9 15:17:23 2020 (r361967) > >> @@ -751,9 +751,11 @@ pgadjustjobc(struct pgrp *pgrp, int entering) > >> { > >> > >> PGRP_LOCK(pgrp); > >> - if (entering) > >> + if (entering) { > >> + MPASS(pgrp->pg_jobc >= 0); > >> pgrp->pg_jobc++; > >> - else { > >> + } else { > >> + MPASS(pgrp->pg_jobc > 0); > >> --pgrp->pg_jobc; > >> if (pgrp->pg_jobc == 0) > >> orphanpg(pgrp); > > > > We seem to be doing something wrong here, but I'm still working on > > reproducing it on a machine that actually has usable swap configured > > to get a dump. I've hit one of these asserts just from hitting the > > power button to shutoff from within xfce (hitting the latter branch > > with pgrp->pg_jobc == 0 IIRC) and another laptop panicked sometime > > overnight -- I wasn't able to catch the second one at all, because > > it's hooked up to a switch that loses its mind once that laptop > > panicks and it had to be rebooted before I could attend to it to > > revive network for the other machines on the switch. > > > > Thanks, > > > > Kyle Evans > > > > > -- > Mateusz Guzik