Skip to content
Snippets Groups Projects
Commit 10b83f16 authored by Christoph Berg's avatar Christoph Berg 📡
Browse files

PgCommon.pm: Dump netstat info when ports are in use and debug is on

parent e9e4a719
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ PgCommon - Common functions for the postgresql-common framework
=head1 COPYRIGHT AND LICENSE
(C) 2008-2009 Martin Pitt <mpitt@debian.org>
(C) 2012-2021 Christoph Berg <myon@debian.org>
(C) 2012-2022 Christoph Berg <myon@debian.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
......@@ -1100,6 +1100,7 @@ sub next_free_port {
# port in use by existing cluster
if (exists $ports{$port}) {
print "next_free_port: port $port in use on by existing cluster\n" if exists $ENV{DEBUG_NEXT_FREE_PORT};
system "ss --no-header -ap 'sport >= 5432 and sport <= 5439'" if exists $ENV{DEBUG_NEXT_FREE_PORT};
next;
}
......@@ -1112,6 +1113,8 @@ sub next_free_port {
close SOCK;
unless ($res4) {
print "next_free_port: port $port in use on IPv4: $err\n" if exists $ENV{DEBUG_NEXT_FREE_PORT};
print "next_free_port: port $port in use on IPv4\n" if exists $ENV{DEBUG_NEXT_FREE_PORT};
system "ss --no-header -ap 'sport >= 5432 and sport <= 5439'" if exists $ENV{DEBUG_NEXT_FREE_PORT};
next;
}
}
......@@ -1125,6 +1128,7 @@ sub next_free_port {
close SOCK;
unless ($res6) {
print "next_free_port: port $port in use on IPv6: $err\n" if exists $ENV{DEBUG_NEXT_FREE_PORT};
system "ss --no-header -ap 'sport >= 5432 and sport <= 5439'" if exists $ENV{DEBUG_NEXT_FREE_PORT};
next;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment