pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Avoid picking already-bound TCP ports in kerberos and ldap test 3+ messages / 1 participants [nested] [flat]
* pgsql: Avoid picking already-bound TCP ports in kerberos and ldap test @ 2019-08-04 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2019-08-04 17:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid picking already-bound TCP ports in kerberos and ldap test suites. src/test/kerberos and src/test/ldap need to run a private authentication server of the relevant type, for which they need a free TCP port. They were just picking a random port number in 48K-64K, which works except when something's already using the particular port. Notably, the probability of failure rises dramatically if one simply runs those tests in a tight loop, because each test cycle leaves behind a bunch of high ports that are transiently in TIME_WAIT state. To fix, split out the code that PostgresNode.pm already had for identifying a free TCP port number, so that it can be invoked to choose a port for the KDC or LDAP server. This isn't 100% bulletproof, since conceivably something else on the machine could grab the port between the time we check and the time we actually start the server. But that's a pretty short window, so in practice this should be good enough. Back-patch to v11 where these test suites were added. Patch by me, reviewed by Andrew Dunstan. Discussion: https://postgr.es/m/3397.1564872168@sss.pgh.pa.us Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/45d6789e78dc2997292a528e2538fa496485b85f Modified Files -------------- src/test/kerberos/t/001_auth.pl | 2 +- src/test/ldap/t/001_auth.pl | 2 +- src/test/perl/PostgresNode.pm | 130 ++++++++++++++++++++++++++-------------- 3 files changed, 86 insertions(+), 48 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Avoid picking already-bound TCP ports in kerberos and ldap test @ 2019-08-04 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2019-08-04 17:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid picking already-bound TCP ports in kerberos and ldap test suites. src/test/kerberos and src/test/ldap need to run a private authentication server of the relevant type, for which they need a free TCP port. They were just picking a random port number in 48K-64K, which works except when something's already using the particular port. Notably, the probability of failure rises dramatically if one simply runs those tests in a tight loop, because each test cycle leaves behind a bunch of high ports that are transiently in TIME_WAIT state. To fix, split out the code that PostgresNode.pm already had for identifying a free TCP port number, so that it can be invoked to choose a port for the KDC or LDAP server. This isn't 100% bulletproof, since conceivably something else on the machine could grab the port between the time we check and the time we actually start the server. But that's a pretty short window, so in practice this should be good enough. Back-patch to v11 where these test suites were added. Patch by me, reviewed by Andrew Dunstan. Discussion: https://postgr.es/m/3397.1564872168@sss.pgh.pa.us Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/803466b6ffaa2e5b94d8ce4d7fffa8185f2a0184 Modified Files -------------- src/test/kerberos/t/001_auth.pl | 2 +- src/test/ldap/t/001_auth.pl | 2 +- src/test/perl/PostgresNode.pm | 130 ++++++++++++++++++++++++++-------------- 3 files changed, 86 insertions(+), 48 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Avoid picking already-bound TCP ports in kerberos and ldap test @ 2019-08-04 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2019-08-04 17:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid picking already-bound TCP ports in kerberos and ldap test suites. src/test/kerberos and src/test/ldap need to run a private authentication server of the relevant type, for which they need a free TCP port. They were just picking a random port number in 48K-64K, which works except when something's already using the particular port. Notably, the probability of failure rises dramatically if one simply runs those tests in a tight loop, because each test cycle leaves behind a bunch of high ports that are transiently in TIME_WAIT state. To fix, split out the code that PostgresNode.pm already had for identifying a free TCP port number, so that it can be invoked to choose a port for the KDC or LDAP server. This isn't 100% bulletproof, since conceivably something else on the machine could grab the port between the time we check and the time we actually start the server. But that's a pretty short window, so in practice this should be good enough. Back-patch to v11 where these test suites were added. Patch by me, reviewed by Andrew Dunstan. Discussion: https://postgr.es/m/3397.1564872168@sss.pgh.pa.us Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4844c6303296d4fa2c9cc800685e4f404dfa5396 Modified Files -------------- src/test/kerberos/t/001_auth.pl | 2 +- src/test/ldap/t/001_auth.pl | 2 +- src/test/perl/PostgresNode.pm | 130 ++++++++++++++++++++++++++-------------- 3 files changed, 86 insertions(+), 48 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2019-08-04 17:07 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-08-04 17:07 pgsql: Avoid picking already-bound TCP ports in kerberos and ldap test Tom Lane <tgl@sss.pgh.pa.us> 2019-08-04 17:07 pgsql: Avoid picking already-bound TCP ports in kerberos and ldap test Tom Lane <tgl@sss.pgh.pa.us> 2019-08-04 17:07 pgsql: Avoid picking already-bound TCP ports in kerberos and ldap test Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox