[pgsql-jp: 30496] pgpoolが一定回数以上の接続でダンマリになる

Y.Watanabe yuw @ msj.biglobe.ne.jp
2003年 7月 17日 (木) 11:50:03 JST


渡辺です。

pgpoolをテストしています。
ある一定回数、psql接続すると、
それ以降まったくpsql接続できなくなるという現象が出て、??です。
これをバグと見るべきなのか、
仕様とみるべき(=使い方or設定が悪い)なのか?
環境が古いものなのが悪いのか・・・?
(でも、運用上、すぐバージョンアップできないんですよね・・・。;_;)

環境:
  RedHatLinux(ja) 6.2
  PostgreSQL 7.1.1-patched (ソースからコンパイル)
  pgpool-0.1.2

やったこと:

(1) tarballを展開する

$tar zxvf pgpool-0.1.2.tar.gz

(2) child.c, pool_process_query.c, pool_stream.c の三つのファイルの下記2行を修正

修正前:
#include "server/postgres_fe.h"
#include "server/libpq/pqcomm.h"
修正後:
#include "postgres_fe.h"
#include "libpq/pqcomm.h"

(3) configureして、makeする

[watanabe @ myhost]$ ./configure
creating cache ./config.cache
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... found
checking for working autoconf... found
checking for working automake... found
checking for working autoheader... found
checking for working makeinfo... found
checking for working lex... found
checking how to run the C preprocessor... gcc -E
checking for flex... lex
checking for flex... (cached) lex
checking for yywrap in -ll... yes
checking lex output file root... lex.yy
checking whether yytext is a pointer... yes
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for fcntl.h... yes
checking for unistd.h... yes
checking for getopt.h... yes
checking for netinet/tcp.h... yes
checking for netinet/in.h... yes
checking for sys/param.h... yes
checking for sys/types.h... yes
checking for sys/time.h... yes
checking for working const... yes
checking for pid_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking return type of signal handlers... void
checking for vprintf... yes
checking for wait3 that fills in rusage... yes
checking for setsid... yes
checking for select... yes
checking for socket... yes
checking for strdup... yes
checking for strerror... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating config.h

[watanabe @ myhost pgpool-0.1.2]$ make
gcc -DHAVE_CONFIG_H     -DDEFAULT_CONFIGDIR=\"/usr/local/etc\" -I /usr/local/pgsql/include    -g -
O2 -c main.c
gcc -DHAVE_CONFIG_H     -DDEFAULT_CONFIGDIR=\"/usr/local/etc\" -I /usr/local/pgsql/include    -g -
O2 -c child.c
gcc -DHAVE_CONFIG_H     -DDEFAULT_CONFIGDIR=\"/usr/local/etc\" -I /usr/local/pgsql/include    -g -
O2 -c pool_auth.c
gcc -DHAVE_CONFIG_H     -DDEFAULT_CONFIGDIR=\"/usr/local/etc\" -I /usr/local/pgsql/include    -g -
O2 -c pool_config.c
gcc -DHAVE_CONFIG_H     -DDEFAULT_CONFIGDIR=\"/usr/local/etc\" -I /usr/local/pgsql/include    -g -
O2 -c pool_error.c
gcc -DHAVE_CONFIG_H     -DDEFAULT_CONFIGDIR=\"/usr/local/etc\" -I /usr/local/pgsql/include    -g -
O2 -c pool_process_query.c
gcc -DHAVE_CONFIG_H     -DDEFAULT_CONFIGDIR=\"/usr/local/etc\" -I /usr/local/pgsql/include    -g -
O2 -c pool_stream.c
gcc -DHAVE_CONFIG_H     -DDEFAULT_CONFIGDIR=\"/usr/local/etc\" -I /usr/local/pgsql/include    -g -
O2 -c pool_connection_pool.c
gcc  -g -O2  -o pgpool  main.o child.o pool_auth.o pool_config.o pool_error.o pool_process_query.o
 pool_stream.o pool_connection_pool.o  

(4) su してmake install する

[watanabe @ myhost pgpool-0.1.2]$ su
Password: 
[root @ myhost pgpool-0.1.2]# make install
make[1]: Entering directory `/home/watanabe/src/pgpool-0.1.2'
/bin/sh ./mkinstalldirs /usr/local/bin
  /usr/bin/install -c  pgpool /usr/local/bin/pgpool
/bin/sh ./mkinstalldirs /usr/local/etc
 /usr/bin/install -c -m 644 ./pgpool.conf.sample /usr/local/etc/pgpool.conf.sample
make[1]: Nothing to be done for `install-data-am'.
make[1]: Leaving directory `/home/watanabe/src/pgpool-0.1.2'

(5) pgpool.conf の作成(pgpool.conf.sampleをcpしただけ)
[root @ myhost pgpool-0.1.2]# cd /usr/local/etc
[root @ myhost etc]# cp pgpool.conf.sample pgpool.conf

(6) pgpoolをrootで起動

[root @ myhost etc]# pgpool &
[1] 27610
[1]+  Done                    pgpool
[root @ myhost etc]# exit
exit

(7) 一般ユーザでcreatedbする

[watanabe @ myhost]$ createdb testdb
CREATE DATABASE

(8) 作ったDBにpsql接続し、すぐ\qで出る

[watanabe @ myhost]$ psql -d testdb -p 9999
Welcome to psql, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

testdb=# \q

(9) 接続&\qで出る を繰り返す (8)とあわせ、計16回。

(10) 17回目のpsql接続で、反応が返ってこなくなる。

[watanabe @ myhost pgpool-0.1.2]$ psql -d testdb -p 9999
(音沙汰なし・・・・)


そのときのtopコマンドの結果が以下のとおり。


  PID USER     PRI  NI  SIZE  RSS SHARE STAT  LIB %CPU %MEM   TIME COMMAND
27647 postgres   0   0  2376 2348  1780 S       0  0.0  3.7   0:00 postgres: watanabe testdb [local] idle
27649 postgres   0   0  2232 2192  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27651 postgres   0   0  2232 2192  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27665 postgres   0   0  2232 2188  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27667 postgres   0   0  2232 2188  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27669 postgres   0   0  2232 2188  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27671 postgres   0   0  2232 2188  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27673 postgres   0   0  2232 2188  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27675 postgres   0   0  2232 2188  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27677 postgres   0   0  2232 2188  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27653 postgres   0   0  2228 2184  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27655 postgres   0   0  2228 2184  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27657 postgres   0   0  2228 2184  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27659 postgres   0   0  2228 2184  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27661 postgres   0   0  2228 2184  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
27663 postgres   0   0  2228 2184  1632 S       0  0.0  3.4   0:00 postgres: watanabe testdb [local] idle
26669 watanabe   0   0   564  564   312 S       0  0.0  0.8   0:00 -bash
26718 watanabe  13   0   524  524   316 R       0  1.5  0.8   0:20 top
27612 root       0   0   460  460   412 S       0  0.0  0.7   0:00 pgpool
27613 root       0   0   452  452   412 S       0  0.0  0.7   0:00 pgpool
27614 root       0   0   452  452   412 S       0  0.0  0.7   0:00 pgpool
27615 root       0   0   452  452   412 S       0  0.0  0.7   0:00 pgpool
27616 root       0   0   452  452   412 S       0  0.0  0.7   0:00 pgpool
27617 root       0   0   452  452   412 S       0  0.0  0.7   0:00 pgpool
27618 root       0   0   452  452   416 S       0  0.0  0.7   0:00 pgpool
27619 root       0   0   452  452   416 S       0  0.0  0.7   0:00 pgpool
27620 root       0   0   452  452   416 S       0  0.0  0.7   0:00 pgpool
27621 root       0   0   452  452   416 S       0  0.0  0.7   0:00 pgpool
27622 root       0   0   452  452   416 S       0  0.0  0.7   0:00 pgpool
27623 root       0   0   452  452   416 S       0  0.0  0.7   0:00 pgpool
27624 root       0   0   452  452   416 S       0  0.0  0.7   0:00 pgpool
27625 root       0   0   452  452   416 S       0  0.0  0.7   0:00 pgpool
27626 root       0   0   452  452   416 S       0  0.0  0.7   0:00 pgpool
27627 root       0   0   452  452   416 S       0  0.0  0.7   0:00 pgpool
27611 root       0   0   436  436   408 S       0  0.0  0.6   0:00 pgpool
11101 postgres   0   0   436  316   256 S       0  0.0  0.5   0:03 /usr/local/pgsql/bin/postmaster -D /usr/local/pgs
26668 root       0   0   276  276     0 S       0  0.0  0.4   0:00 login -- watanabe
26695 root       0   0   276  276     0 S       0  0.0  0.4   0:00 login -- watanabe






pgsql-jp メーリングリストの案内