Test: attempt to fix 001.load_balance test timeout.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Wed, 13 Sep 2023 08:51:21 +0000 (17:51 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Wed, 13 Sep 2023 09:17:03 +0000 (18:17 +0900)
Examining the log reveals that the error was caused by bind error:
address already used.  This is strange because SO_REUSEADDR flags is
set to the listening socket.  I guess the cause is, the kernel is not
fast enough to clean up the socket used by previous pgpool process.
To fix this, existing CHECK_TIME_WAIT environment variable parameter
is modified so that it checks the socket by using netstat -tulpn,
rather than netstat -a, which is too slow.

src/test/pgpool_setup.in
src/test/regression/tests/001.load_balance/test.sh

index 879d02d80e983eb3f84b6c572462a0698e74b829..3823d85f20a5d2a5cb7a146dde445c6241a860ec 100644 (file)
@@ -1320,7 +1320,7 @@ echo 'dir=`pwd`' > $SHUTDOWNALL
 echo "PGPOOL_INSTALL_DIR=$PGPOOL_INSTALL_DIR" >> $SHUTDOWNALL
 echo '$PGPOOL_INSTALL_DIR/bin/pgpool -f $dir/etc/pgpool.conf -m f stop && while [ -f $dir/run/pgpool.pid ];do sleep 1;done' >> $SHUTDOWNALL
 if [ $CHECK_TIME_WAIT != "false" ];then
-   echo "while  netstat -a|grep $ORIGBASEPORT ;do sleep 1;done" >> $SHUTDOWNALL
+   echo "while netstat -tulpn 2>/dev/null|grep pgpool|grep -w $ORIGBASEPORT ;do sleep 1;done" >> $SHUTDOWNALL
 fi
 chmod 755 $SHUTDOWNALL
 echo 'dir=`pwd`' > $PGPOOL_RELOAD
index 20262a178ee6f14fdccdd145fcfca5fff383dd1e..c3bad54827df2d86a7af0f0ce3ea226d4dbf1a4f 100755 (executable)
@@ -8,6 +8,7 @@ PSQL=$PGBIN/psql
 PSQLOPTS="-a -q -X"
 PGPOOLBIN=$PGPOOL_INSTALL_DIR/bin
 export PGDATABASE=test
+export CHECK_TIME_WAIT=true
 
 # sleep time after reload in seconds
 st=10