Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8XHr-0005Km-Pg for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Jan 2022 00:51:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n8XHq-0000mw-E9 for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Jan 2022 00:51:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8XHo-0000mn-EN for pgsql-hackers@lists.postgresql.org; Sat, 15 Jan 2022 00:51:18 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8XHf-00052R-F4 for pgsql-hackers@postgresql.org; Sat, 15 Jan 2022 00:51:16 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 8923A3200D60; Fri, 14 Jan 2022 19:51:03 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 14 Jan 2022 19:51:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=AepRUpd+juX7Kxp37JEqKXW/MJw vVr82ZhyZsCIOXtM=; b=V+j48ut5nkJpHtXA8HAUzBqLOEaCEKfotL3zcCj4/bH nrg0L5RV6BaZFEys6D7VeqA7ip6IYPGxeHxxWk3zusxQcEkUxtQ8C028desB8V1J x8jYP3KYDOPk27CAu/3+BnmuuEa8gUk0Q95IZeKyWwGlFPLpAt7ALcwihfbhadq1 mOPZCRawHF+0ii4wu+nsk82LGMpRkPdlS37x9+uhUS2mN/kfM4ENHWl8JPVA06HV 16eQaT9dm1zaHyTF5rraVP+85AgnoFn7T/QiUUY8dCJcQBZAxqXQk17Xm/Vf4dBS ATVI+z06LQ5aRnCgwmGUnPYJ5/0pOuRnRpZMX0RLSeQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=AepRUp d+juX7Kxp37JEqKXW/MJwvVr82ZhyZsCIOXtM=; b=W1ODoWCDerw24k85SfeV7L 12Un2GYMdwukVbpfXBDH3kTK9Cm3aNUiYRJ3QaX0rjBz2H8R58cZlPSmG9Mgbm3w nEKEWeD0+V1zUPEy6DKZ8xtwir4HrxtoMbLJCvsrQbE7gbF0BL4IbhJg4/s/px2P oRqitx/XmGKEvODSzwpXPBwgA12JsiMMVSiUwhhXpQKUVHYk/uYL8MzI8hrxo10S zDzOTT3fCyU1puZp3QwhBNR4plURP39u5iZzvzVkGmuVoo9dY76eEh3pUoVT8emS Ix1FLMNRVap8FV5xk0c4s0bqC6n3ARihyIm4cfyvbOhp/JsJtrEpyHvJv4vlNZgA == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrtdeigddviecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepteehheeigfdulefhvedvvddtjeehheekleetkeevgeegudeileeiudeugfef tdejnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgii vghlrdguvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Jan 2022 19:51:02 -0500 (EST) Date: Fri, 14 Jan 2022 16:51:01 -0800 From: Andres Freund To: Thomas Munro Cc: Alexander Lakhin , Tom Lane , Andrew Dunstan , pgsql-hackers Subject: Re: Why is src/test/modules/committs/t/002_standby.pl flaky? Message-ID: <20220115005101.xkfe232v3rgcj3sv@alap3.anarazel.de> References: <1fe6b898-1722-d190-03c0-bf4c4884a748@gmail.com> <2763901.1641932210@sss.pgh.pa.us> <20220114202848.x2ctpjgyreqx22dv@alap3.anarazel.de> <20220114224420.7kkorae3rxtx547n@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-01-15 13:19:42 +1300, Thomas Munro wrote: > On Sat, Jan 15, 2022 at 11:44 AM Andres Freund wrote: > > > The patch Alexander tested most recently uses a tri-state eof flag [...] > > > > What about instead giving WalReceiverConn an internal WaitEventSet, and using > > that consistently? I've attached a draft for that. > > > > Alexander, could you test with that patch applied? > > Isn't your patch nearly identical to one that I already posted, that > Alexander tested and reported success with here? Sorry, somehow I missed that across the many patches in the thread... And yes, it does look remarkably similar. > https://www.postgresql.org/message-id/5d507424-13ce-d19f-2f5d-ab4c6a987316%40gmail.com > > I can believe that fixes walreceiver One thing that still bothers me around this is that we didn't detect the problem of the dead walreceiver connection, even after missing the FD_CLOSE. There's plenty other ways that a connection can get stalled for prolonged was, that we'd not get notified about either. That's why there's wal_receiver_timeout, after all. But from what I can see wal_receiver_timeout doesn't work even halfway reliably, because of all the calls down to libpqrcv_PQgetResult, where we just block indefinitely? This actually seems like a significant issue to me, and not just on windows. > (if we're sure that there isn't a libpq-changes-the-socket problem) I just don't see what that problem could be, once connection is established. The only way a the socket fd could change is a reconnect, which doesn't happen automatically. I actually was searching the archives for threads on it, but I didn't find much besides the references around [1]. And I didn't see a concrete risk explained there? > but AFAICS the same problem exists for postgres_fdw and async append. Perhaps - but I suspect it'll matter far less with them than with walreceiver. > That's why I moved to trying to > fix the multiple-WES thing (though of course I agree we should be > using long lived WESes wherever possible That approach seems like a very very leaky bandaid, with a decent potential for unintended consequences. Perhaps there's nothing better that we can do, but I'd rather try to fix the problem closer to the root... > I just didn't think that seemed back-patchable, so it's more of a feature > patch for the future). Hm, it doesn't seem crazy invasive to me. But I guess we might be looking at a revert of the shutdown changes for now anyway? In that case we should be fixing this anyway, but we might be able to afford doing it in master only? Greetings, Andres Freund [1] https://www.postgresql.org/message-id/CA%2BhUKG%2BzCNJZBXcURPdQvdY-tjyD0y7Li2wZEC6XChyUej1S5w%40mail.gmail.com