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 1n6y1h-0000fN-4k for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Jan 2022 17:00:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n6y1f-0004p5-Dk for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Jan 2022 17:00:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n6y1f-0004ov-37 for pgsql-hackers@lists.postgresql.org; Mon, 10 Jan 2022 17:00:07 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n6y1c-0006QA-Gc for pgsql-hackers@postgresql.org; Mon, 10 Jan 2022 17:00:06 +0000 Received: by mail-lf1-x133.google.com with SMTP id x7so46567241lfu.8 for ; Mon, 10 Jan 2022 09:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=YguBM8yZPFfyAFGuzaGKjopNwcfzyKbGWkyEpZ1gAWo=; b=I4H1SMkgE/k4gtOxWnL2WKn9uz4mmYT2kZyrz/dg4iA+YYijF2QhQyP3EFgw/Dl0F5 3gftaKouapElDaxtf6ZeHzaPISvruspahR7oEzKFRNwQ3zer25yZ5qZdVHyBtwG4zq0P +Tw2T9MMS12M/3nYz5jYFUK72X5nhxu8JMjwD5gQcfhkZB9pXOKI0JwIFhUduxdhZkfA GjtNiWOIgOPIndEkSDSfUcMvQOjbD5SxKF3fAK6wTZu9CaDIMw10l7/operNVZ9z+8cT J6/D7b0pp7pop/6IqOe9FzN0uF2KUlZC5yDb+YiqwIvonlmf3YlQwyUU6P+aLdcI7B1p CTzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=YguBM8yZPFfyAFGuzaGKjopNwcfzyKbGWkyEpZ1gAWo=; b=HXssyUEp63s4SO6FZlm62hPZEhUZMsYt2U36hzm6Nci55IwFQ9gK611ab4yTeNf82a J25pQot8hJc+8D5wOcCRP5m2Umo2dcXfWzwzAW512i/eEXRgeeFlESC6Vjy5riqGm+7F QvfH8yi11QLkuwpAtmb7Ee9c7LR8vYA+3eOoM3DTIWOIl2fZafxoxBrSAyVFdUNP/XOT Emasks7Jr1tVW4XDO+AhMV9cP+JBFFUbLsrqjK0IC+09pbmNqrAjKHoiBCtfz2zIJtNo Cwx/VXMPrbzn9LZmJz8uMAPyZN3fJmzNNt78HRxNe8mJzr9OW+UvaKuIpfk+qdySDbx/ 3Q/Q== X-Gm-Message-State: AOAM5334s+k5HTRgG9Q0NKAxcRVpzETQ6QjylCsL9xcQnr4Vk29d9Oef WJdS/h9TCDh8IvEjEm6KXSjZ8gvoy5kl5g== X-Google-Smtp-Source: ABdhPJx8cHUfMl6G798U/cbY0RCBkDJg+MWQp9aFGrpc7SkkawsaphlIDZ+/EVRWPxHUpxKutWjmrQ== X-Received: by 2002:a05:651c:1a07:: with SMTP id by7mr258183ljb.321.1641834002705; Mon, 10 Jan 2022 09:00:02 -0800 (PST) Received: from [1.0.0.7] ([178.155.6.84]) by smtp.gmail.com with ESMTPSA id a35sm1078053ljq.7.2022.01.10.09.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Jan 2022 09:00:02 -0800 (PST) Subject: Re: Why is src/test/modules/committs/t/002_standby.pl flaky? To: Thomas Munro Cc: Tom Lane , Andrew Dunstan , pgsql-hackers References: <1600941.1641685316@sss.pgh.pa.us> <1609152.1641691036@sss.pgh.pa.us> <3b904d7b-ef84-6f1b-9326-9f88c1374eb8@gmail.com> From: Alexander Lakhin Message-ID: <5d507424-13ce-d19f-2f5d-ab4c6a987316@gmail.com> Date: Mon, 10 Jan 2022 20:00:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 10.01.2022 12:40, Thomas Munro wrote: > This is super quick-and-dirty code (and doesn't handle some errors or > socket changes correctly), but does it detect the closed socket? Yes, it fixes the behaviour and makes the 002_standby test pass (100 of 100 iterations). I'm yet to find out whether the other WaitLatchOrSocket' users (e. g. postgres_fdw) can suffer from the disconnected socket state, but this approach definitely works for walreceiver. Best regards, Alexander