pgpool2.git / summary / log / commit / refs

commit    bcecfcc8bbd045cc15f6b5d1b75ba31b41f3f912
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Wed Dec 03 02:12:22 2014 +0000

    Add memory leak regression test.
    
    The test executes pgbench -S for a while (currently 30 seconds) and
    compare pgpool child process size before and after. If it increases,
    the test fails. The test is executed in streaming replication, native
    replication and raw mode.


src/test/regression/tests/060.memory_leak/test.sh | 65 +++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/test/regression/tests/060.memory_leak/test.sh b/src/test/regression/tests/060.memory_leak/test.sh new file mode 100755 index 000000000..a46b7ef61 --- /dev/null +++ b/src/test/regression/tests/060.memory_leak/test.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +#------------------------------------------------------------------- +# Testing memory leak. To detect the memory leak, we perform pgbench +# -S for sometime and see how much the pgpool child process is growing +# by using ps command. + +PGBENCH=$PGBENCH_PATH +WHOAMI=`whoami` +source $TESTLIBS +TESTDIR=testdir + +for mode in s r n +do + rm -fr $TESTDIR + mkdir $TESTDIR + cd $TESTDIR + + # create test environment + echo -n "creating test environment..." + $PGPOOL_SETUP -m $mode -n 2 || exit 1 + echo "done." + + source ./bashrc.ports + + export PGPORT=$PGPOOL_PORT + + # set pgpool number of child to 1 + echo "num_init_children = 1" >> etc/pgpool.conf + + # start pgpool-II + ./startall + + sleep 1 + + # initialize tables + $PGBENCH -i test + + # find pgpool-II child process id and grab initial process size (virtual size) + foo=`ps x|grep "pgpool: wait for connection request"` + pid=`echo $foo|awk '{print $1}'` + init_size=`ps l $pid|tail -1|awk '{print $7}'` + echo "init_size: $init_size" + + # run pgbench for a while + $PGBENCH -S -T 30 test + + after_size=`ps l $pid|tail -1|awk '{print $7}'` + delta=`expr $after_size - $init_size` + + echo "initial process size: $init_size after size: $after_size delta: $delta" + + test -f "$delta -eq 0" + + if [ $? != 0 ];then + echo "memory leak in $delta KB in mode:$mode" + ./shutdownall + exit 1 + fi + + ./shutdownall + + cd .. +done + +exit 0 [parent: 2637fb3a18b9]