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.89) (envelope-from ) id 1iHHik-0002o0-1n for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Oct 2019 01:21:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHHih-0002vc-BS for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Oct 2019 01:21:51 +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 1iHHih-0002vH-0b for pgsql-bugs@lists.postgresql.org; Mon, 07 Oct 2019 01:21:51 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iHHie-00071O-CM for pgsql-bugs@lists.postgresql.org; Mon, 07 Oct 2019 01:21:49 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 563F42073F; Sun, 6 Oct 2019 21:21:47 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 06 Oct 2019 21:21:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=Q8ld5TCiA1+LF5ROcwoE4Ioat/G 8LDveOKiyIHFqUcg=; b=KnsGI3x+t7T1TEQhI4Nrg3KD2s+OX4wuzTQge5wf66B G4iYy51HvfHUzfh7Y/2h0F9oCh0yW0U+joHOOuw5xvHdNQ5z0LDk14OJYKUyzc09 eH//jjAFyC6n293l5YPeOTWbNv41LuzDdI/Pq+SEU99t40v/1upwq3g3q/BRiol2 3SuhuQ2LNAhco+YwjZBtYgs6068GL2NwkidO/w3yVyTXq4tRsdE8UIZwBqGkLPNz gKxJ99OIEGwcrHpJyoGeZENVugZ86KQS6taYh06szidm/Z4rwdTCW0h4FNswFCRt 7qF0t2WRDcLkcn5wyTsOzaFpkD5K5borxve+PWQkD9w== 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=fm3; bh=Q8ld5T CiA1+LF5ROcwoE4Ioat/G8LDveOKiyIHFqUcg=; b=iujI5NdQ4O27Rtx2G3mW6W o3fwYhIrz70eDwfEyt2RsjMfdi6ftuh4M7xEnD3PhagR6hnYwDu0CVraB9xxY4F8 d/I+PqNvqiAeFmkZRuArKEFZdPCPQSRPCPgS1b/w4NsFUx8p6XZsQZevGld9lZMK y6Ep4EcCzg98Fg1zYGfBOY4kYZuTgYXKDlSSu42THEepmQCvPa6BXo1VGoworUlp X80GPzG1l53aVonxURHboaSGD88kO2OsYF9LYvzD6yOfs2wSBZ02K0AnAWaLYw4n egnjNnSF8eGKSYfc9HtRkoNv7dXnQZjcMiGCWTZvynjL4DjVqon7/TUpNHEHENwg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrheeigdegjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdejtddmnecujfgurhepfffhvf fukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhi vghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecukfhppeduuddurddutd dvrddukedtrddukeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehp rghquhhivghrrdighiiinecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 8CD7BD6005E; Sun, 6 Oct 2019 21:21:43 -0400 (EDT) Date: Mon, 7 Oct 2019 10:21:32 +0900 From: Michael Paquier To: Rob Emery Cc: pgsql-bugs@lists.postgresql.org Subject: Re: [PATCH] Re: BUG #16032: pg_basebackup when running on Windows doesn't clean up on failure correctly Message-ID: <20191007012132.GE14532@paquier.xyz> References: <16032-4ba56823a2b2805f@postgresql.org> <0c6477f627e63c9cea68a6eda3f29a74@mintsoft.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="DWg365Y4B18r8evw" Content-Disposition: inline In-Reply-To: <0c6477f627e63c9cea68a6eda3f29a74@mintsoft.net> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --DWg365Y4B18r8evw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 06, 2019 at 08:15:10PM +0100, Rob Emery wrote: > Hello, >=20 > I've already posted this to pg_hackers, but I'm not sure if it's > more normal to post proposed fixes against the bug itself; so see > attached if needed. Discussing patches on -bugs threads is perfectly fine :) Regarding your patch, anything living in the middle of processing (basically calling disconnect_and_exit() in ~11 and exit() for 12~) would fail into this category. Wouldn't it make sense here to use atexit() to ensure that the cleanup always happens? I am not sure that it is a good idea to hope that anything processing the base backup COPY chunks will remember to clean up those handles in the event of an error. I am ready to bet that any future code will forget to add that so we would keep falling into the same trap. -- Michael --DWg365Y4B18r8evw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl2akxwACgkQnvQgOdby QH2C0w//dG3sQk1KxAkHtE2+L2m2YWIaf41CwTpIp+pyHyK0KnxtZjnVbjDKOudm UCx1gxNrjwUpDCPbFzUNx6UY1rZeNhtseFc+LxUlTJFlxlma+UYfBMpxmsivZwKe LpJo4HTlROo1M8JQWWjRoY0a6xpCnEciOmy1M33WVnjsx3hjd4AupX9THo4g4v3e pXxbqcXymEauOEyIxjIrdiKIsLt0die+rVgVPgnnLJUnfmYgo4Q4YcuO30WsxCM9 nqDGyd5dNzNdpzIANd2wPkMovcHp4Y7esXkNjvVF4t+rRIR9VXtk7XQ+iXywmmGP MZN9spAFIfKRFDh+Zhvxzx//3kQ/cYQRTCQz2zEzQdImogssbojN9xsSvIji/Ohl GCK42bWlIHvqHiUAIE92FpVVbBlS8ZB+aOgnSkB1UhrcCMKwArdGtb4PCBe1nsWx 8crpNTSUChaMfreptlprg8z4Ein4SheXwOj6V7kds9Poa9JbIzerFuJTHyFDuH4+ UJyvgD5DZs0dMQRikHRHfRavyjIilT85Peyp5nC2+38FweIclM1lFkh1cDeKZgjJ 87Txh1nbKqqrdV8nZVmVXzkheX2nhy0TrA20u504YwwMCY998yqFJs58CJ3///xy hms1bJGLINhr6D0VQeCIdnqz3NefYkicn3LbK7Liub8EnyiER7I= =xh0R -----END PGP SIGNATURE----- --DWg365Y4B18r8evw--