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 1pNiEq-0007Xt-L1 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Feb 2023 22:39:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pNiEp-0003S8-Aq for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Feb 2023 22:39:27 +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 1pNiEo-0003Ri-Vs for pgsql-hackers@lists.postgresql.org; Thu, 02 Feb 2023 22:39:27 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pNiEm-0003tU-54 for pgsql-hackers@lists.postgresql.org; Thu, 02 Feb 2023 22:39:25 +0000 Received: by mail-pj1-x102c.google.com with SMTP id on9-20020a17090b1d0900b002300a96b358so3251981pjb.1 for ; Thu, 02 Feb 2023 14:39:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Jl7X7/s9Gbl3yeMVneUJSjwJ8GCtDyPlkqzC9JG/HH0=; b=h/lKLJrI/a8qnpNDmAwQELviyMO9wCZLjwn7lRitWpKcVCcmx0Dno93YXFeyEwDmR0 rdMt0xbafVBVKtyg4eyu/yiTPJiNVPIxWLz6RxJhbIw4GqSy7AeTd/wdFakCOuY0mMMo dkEhhXkphQzaLyhnGerw0PVVfpofOPGelxgsMrxyvWV3kgIw+71tFqZTFRsPWlSuDAj+ RLgB4HhzhnG6wDcG93SWCEh8VEl+TZGAQIJfq3YK0g+15fLa7PHeoioJ3HSuSyYX4Wcs x+JRxYP/QSeAY2yUAjWYZPjwLF68V/2HZqelb7dP45vuEC+OSE0qUXukRibbMJeHXJAx zH1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Jl7X7/s9Gbl3yeMVneUJSjwJ8GCtDyPlkqzC9JG/HH0=; b=3nw8wFOF2WP7g2MZdS3llKQXyGTc2O87KmcySyTyk1/hICqqzRDHPGaq1f0YfyAbce U76jo2oN54LbHq7Y896gGKTXA3SlXZ4I0PnurZxzKzmRv+sfGbofw2zenrJr3kxZ8VGs kTqlkB/M26R9MrJj2kpinPo/1pRRopSbClAOJoAMoD8CDR9jcMZZL2FnFzO3XBx23Rx6 3JU8j5NkzsQljgzW3jTup+rCYvmCPKw/iR2fT595aly+xv2cmGt/h7QDYa+xs1FNCHda fjrT7dlOxggnT0JubjXgtK14TLVdRQuFM28FpnFacI9qWelpujwqj9TATQoJQ//VhNVB 9PlA== X-Gm-Message-State: AO0yUKX+XY5CQYJMTANjRdX23K3IdwWmo0ZIXHQHYusfU2J+Up7sRKJP /to5vhMpx6r4aiEyTFPLCBY= X-Google-Smtp-Source: AK7set8asT08Da/0M796aG7dS4tIHggv/gNc8KZBi8pUiKxjjHx/YT4MrC98rPtRGM86CHrxowjQ5A== X-Received: by 2002:a17:902:f54b:b0:196:7c50:f5f8 with SMTP id h11-20020a170902f54b00b001967c50f5f8mr10241318plf.28.1675377563121; Thu, 02 Feb 2023 14:39:23 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id w11-20020a170902d70b00b00198be44edaesm183928ply.88.2023.02.02.14.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 14:39:22 -0800 (PST) Date: Thu, 2 Feb 2023 14:39:19 -0800 From: Nathan Bossart To: Robert Haas Cc: Michael Paquier , Tom Lane , Andres Freund , Thomas Munro , Fujii Masao , Postgres hackers Subject: Re: Weird failure with latches in curculio on v15 Message-ID: <20230202223919.GA3947443@nathanxps13> References: <1369666.1675264346@sss.pgh.pa.us> <20230201165801.33ydbxvjdbomjqa7@alap3.anarazel.de> <20230201175806.GA3199959@nathanxps13> <20230201223555.GA3721373@nathanxps13> <1449633.1675305284@sss.pgh.pa.us> <20230202200957.GA3944544@nathanxps13> <20230202220113.GA3945808@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230202220113.GA3945808@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Feb 02, 2023 at 02:01:13PM -0800, Nathan Bossart wrote: > I've been digging into the history here. This e-mail seems to have the > most context [0]. IIUC this was intended to prevent "fast" shutdowns from > escalating to "immediate" shutdowns because the restore command died > unexpectedly. This doesn't apply to archive_cleanup_command because we > don't FATAL if it dies unexpectedly. It seems like this idea should apply > to recovery_end_command, too, but AFAICT it doesn't use the same approach. > My guess is that this hasn't come up because it's less likely that both 1) > recovery_end_command is used and 2) someone initiates shutdown while it is > running. Actually, this still doesn't really explain why we need to exit immediately in the SIGTERM handler for restore_command. We already have handling for when the command indicates it exited due to SIGTERM, so it should be no problem if the command receives it before the startup process. And HandleStartupProcInterrupts() should exit at an appropriate time after the startup process receives SIGTERM. My guess was that this is meant to allow breaking out of the system() call, but I don't understand why that's important here. Maybe we could just remove this exit-in-SIGTERM-handler business... -- Nathan Bossart Amazon Web Services: https://aws.amazon.com