public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andrew Dunstan <[email protected]>
To: Tom Lane <[email protected]>
To: Yurii Rashkovskii <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] Allow Postgres to pick an unused port to listen
Date: Fri, 7 Apr 2023 08:06:55 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CA+RLCQwJBGAnBo7OZ6QxqJjEn6w=Mju9GrHQmwFxX_io+4Cwhw@mail.gmail.com>
	<[email protected]>


On 2023-03-29 We 07:55, Tom Lane wrote:
> Yurii Rashkovskii<[email protected]>  writes:
>> I would like to suggest a patch against master (although it may be worth
>> backporting it) that makes it possible to listen on any unused port.
> I think this is a bad idea, mainly because this:
>
>> Instead, with this patch, one can specify `port` as `0` (the "wildcard"
>> port) and retrieve the assigned port from postmaster.pid
> is a horrid way to find out what was picked, and yet there could
> be no other.
>
> Our existing design for this sort of thing is to let the testing
> framework choose the port, and I don't really see what's wrong
> with that approach.  Yes, I know it's theoretically subject to
> race conditions, but that hasn't seemed to be a problem in
> practice.  It's especially not a problem given that modern
> testing practice tends to not open any TCP port at all, just
> a Unix socket in a test-private directory, so that port
> conflicts are a non-issue.


For TAP tests we have pretty much resolved the port collisions issue for 
TCP ports too. See commit 9b4eafcaf4

Perhaps the OP could adapt that logic to his use case.


cheers


andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] Allow Postgres to pick an unused port to listen
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox