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 1pgf80-0003WX-32 for pgsql-general@arkaria.postgresql.org; Mon, 27 Mar 2023 05:10:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pgf7y-0004rq-Mi for pgsql-general@arkaria.postgresql.org; Mon, 27 Mar 2023 05:10:42 +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 1pgf7y-0004rg-8l for pgsql-general@lists.postgresql.org; Mon, 27 Mar 2023 05:10:42 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pgf7r-0002jK-Nx for pgsql-general@postgresql.org; Mon, 27 Mar 2023 05:10:41 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C69655C0059; Mon, 27 Mar 2023 01:10:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 27 Mar 2023 01:10:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1679893834; x=1679980234; bh=RH 0Da8wHt3+YfnCO5wMxczbvlqNXdkfxbzVmcqw2jRA=; b=Pda/p4emtLkxcV2cUE 0/Q2GtHBEEMCDI+e5AHVOujrE3xo1Dp5Rn/QXzBAdol9dB6Jk8jEr+iZsPaSqJHI Ip3mVf5uIQ1VZaSMT1B/JK05irvDKWlRJ2icQmGwF26sMmOKfKZPFrWU1y1MQWQj /RAYoNLkMX//Lsr3O6rO71SEXpkOokb9vFu9emMqGfHGj3o+1jQhMLkrD6ELcxV5 fwNM4L0AfZ1XC/8FnL6MnTuVh3X0jKNc5L73tWEMR6WRu03JYnwTWfilxO4dt1nD lUbkC3qqFmYWGCM4TlSUWHmsnjhCsU0YgkESw6u66Yb0S37h0Z4p2UdITqJoVi4d mAgg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1679893834; x=1679980234; bh=RH0Da8wHt3+Yf nCO5wMxczbvlqNXdkfxbzVmcqw2jRA=; b=hBfcRHZdO3aKftTurMoHA/1KKqH50 zHwjfWK5CADQhTsgOIq7q5g2j6lCGWD/qtux9UZgxcD1KQOvF0kMj5LAXh831ZiT ZcuuGH2c5dgy8wWVKGntwpWl7l2+O3ier9/tdZqmYpckkRT5Hs17nDoRtdEgS9P6 nNBajhcE8WwYhAUUulpGUUks6xkoQTcu15eGv8iL/C7+VJOnRXq310IOBvCst4ro bhS7YqXwuewjkIGn9KEl6pc+z13L9fzh9XjHPcI+RZbdBc3VYZOYZE8+3j8TewFM Z0kEbNvY5Of3i4RulfYvtfmna1+RyWMkAepIhVZLqD94j0WSAG/s3ZuCg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdehuddgleefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 27 Mar 2023 01:10:33 -0400 (EDT) Date: Mon, 27 Mar 2023 14:10:30 +0900 From: Michael Paquier To: Markus Pilman Cc: pgsql-general@postgresql.org Subject: Re: Binding Postgres to port 0 for testing Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="JzBIA94Eprxyvip1" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --JzBIA94Eprxyvip1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Mar 26, 2023 at 10:49:33PM -0600, Markus Pilman wrote: > I somehow didn't consider looking at the postgres tests, though it makes > sense that they need to solve this problem. If I read the perl code > correctly though it seems that this could, in theory, cause a race? The > script checks first whether the port has been assigned to a test, then > binds a socket to check whether it is used by someone else, closes this > test socker, and then starts a server process. I guess it's unlikely > enough, but isn't there a risk that some other process (that isn't > controlled by this perl script) binds to the found port right after this > test bind but right before postgres calls bind? I guess it should be rare > enough so that it wouldn't cause flaky tests. In theory, yes, I recall that's possible in the scripts. But only on Windows where we cannot use socket directories and rely on SSPI authentication while binding all the nodes to listen to 127.0.0.1. On all the other platforms, each test creates its own directory that will be used as path for unix_socket_directories. umask is 0700 and owned by the OS user running the perl tests, so it is isolated as much as it can be. Using the same port should be actually fine as far as I recall, as long as the unix socket paths are different. -- Michael --JzBIA94Eprxyvip1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmQhJUYACgkQnvQgOdby QH0scBAAlpgqYaFqkLySPPai5nWde4zuZ0YeIB26GwdXN8gl9RwTj9zWgHxGCpil /K+ZGUmjfttucJBbDEnAhpkYCX6wGaJVEwsyCk+L8soG3sRoJ81DJOlroQYml60b mWtZhQOdZlJNXklIVUF0P+gnW0IR5+iRe5GLn8XTLMRlV2FNNagJlsx9DVYe9tth V5wrHyEVXtgqrLY5GLftOiWvXpOzWbc+9W0fQMhVqpDAkYLWuizubdNuf+mCmaPZ 0LP9VKR3a8aXzSy6CrfZpFw+4UYE/A+au1n44ZrVUtPHc37vGlfKUK+KBwNKRA4L IWu6Sx7isdlb+92xOBp+fDYbqqA0bOmTWIrkazKPeqkthrM5PyT6qsjnPvZTqBCm Dg4bDzVY7gmbP5es1wgMco10sabB8sWge0TE3w3Lz24XfhW9EdEQEGfWk34Yq550 77sj9Ksja8pEEgHAPNpvPzqdCRKtXAhUIAw9QE7GyETEgJ43qVwMAghASuEV45eq 8AmVN8gABTWazyGJu/Y3JHzsxh68c55TQXHJ9YAV9NRAndgBQwQP8q4SSvJ5v2zE gAXpEZlpfrAv4ZpOlmpyrhDILh4Fk6lhjrjsKopsTk1HdBfJri5D8/MNS5+8lwNc LJawPp+gKUv1kzutce5xWFpaE+gbbuclN/qT/DM4ULo9As2WMlY= =pMm6 -----END PGP SIGNATURE----- --JzBIA94Eprxyvip1--