Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jDwO5-0005Lj-Bb for pgsql-committers@arkaria.postgresql.org; Mon, 16 Mar 2020 20:31:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jDwO4-0001Zp-4i for pgsql-committers@arkaria.postgresql.org; Mon, 16 Mar 2020 20:31:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jDwO3-0001Zh-NE for pgsql-committers@lists.postgresql.org; Mon, 16 Mar 2020 20:30:59 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jDwNx-0003hK-0X for pgsql-committers@lists.postgresql.org; Mon, 16 Mar 2020 20:30:58 +0000 Received: by mail-qt1-x844.google.com with SMTP id d22so15523980qtn.0 for ; Mon, 16 Mar 2020 13:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=DZ0FCj3bnwiZzcVnSZxlZQJkckJHh8Z4d8Fc8CE7Pr8=; b=Ao8DMJgwHdnE8AM9bqFWYybcOzSI6noDp3bffY7D/6fZZjwyG1fnMyXnwwUlKfZJ8/ DRplYUTWFuuZWe2xNxTzewUdnL+qRrNV9lAJCcmwYASQNnm4MYoKkBRwehnqfcUrKSS+ EO+Ug/xt9UBqINl/DUjUSBfD7iBu5syMgJJABAogKXrmySxQPqZJpuSdDFlebQ5pE4yh F1gIMMVHT9XJ0ydv3xFaO4f5Cw1ep7s9MVD2a6jWMpnRnVD9BAhJlQrTlK6zez4gXpJy PLwFsJA74d/sx1mlXeYSYtU4+RX7OYiQH0Zksy7zg7O692v3b0awEWroJHJs0KLx8Owh 6WEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=DZ0FCj3bnwiZzcVnSZxlZQJkckJHh8Z4d8Fc8CE7Pr8=; b=dbCWueUMJKxFpE4Sh/ADpK6Z8cGh2cX/IDkyqLxPB+8Fp4++xDqw8bEB1bCDyOe20/ GwpahTMTmgk12YZUcDFX9bRCulrlL7rbWzYklTN6Wj5qOl6Ir53TDTFrRt4eGbFTQHOQ JOn1DRKd1keCq5rXYWoigWzhkQzvGvmgFriLM5wlRMZ+xQL7nsarD3IiQjQXfQLSudWn 4jtSyYf+v3uQdKDJVdresNoTH5h2Z1IZTFdQ5ciV/ijmu+LuW2FB2XmnRu2fTGMYR3qF s/CPrK8uKCaaANSaadvZAzQQHCZJTc+8nSz0cbXqwjFxu26oThMrOfAgp7N1CImeEVPl dTVw== X-Gm-Message-State: ANhLgQ1Q9hBFIvA/ODht8pIIS+TQuvnls/b+o1JNyQO3fI3FIHa1HLDV MWVHlSRxN7dKNVDhq2GTxuzAcw== X-Google-Smtp-Source: ADFU+vstna08PairclEYiNz2PKQMS9oI3hDQc6VWpd1/OH8aFGKmD1XO25M92pFjpeHeYGl9N7QD7Q== X-Received: by 2002:ac8:4242:: with SMTP id r2mr1905181qtm.83.1584390651996; Mon, 16 Mar 2020 13:30:51 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([201.186.208.119]) by smtp.gmail.com with ESMTPSA id w30sm680336qtw.21.2020.03.16.13.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 13:30:51 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id A01B33006A7; Mon, 16 Mar 2020 17:30:40 -0300 (-03) Date: Mon, 16 Mar 2020 17:30:40 -0300 From: Alvaro Herrera To: Thomas Munro Cc: Alexander Korotkov , Thomas Munro , pgsql-committers Subject: Re: pgsql: Add kqueue(2) support to the WaitEventSet API. Message-ID: <20200316203040.GA4019@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Mar-17, Thomas Munro wrote: > Reproduced here. The problem seems to be that macOS's getppid() > returns the debugger's PID, while the debugger is attached. This > doesn't happen on FreeBSD (even though the debugger does internally > become the parent, getppid() is careful to return the "real" parent > PID so that user space doesn't notice this trickery; apparently Apple > made a different choice). Wow ... Yeah, that was a known problem with FreeBSD, see https://postgr.es/m/1292851036-sup-5399@alvh.no-ip.org Evidently FreeBSD must have fixed it, but macOS has not caught up with that ... > The getppid() check is there to close a vanishingly rare race > condition: when creating a WaitEventSet, we ask the kernel to tell us > when the postmaster exits, but there is a possibility that the > postmaster has already exited; normally that causes an error with > errno == ESRCH (no such PID, it's already gone), but another unrelated > process might have started that has the same PID, so we check if our > ppid has changed after a successful return code. That's not going to > work under a debugger on this OS. Irk. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services