[Pgpool-hackers] md5 authentication hanging in daemon mode
Nicolas Thauvin
nicolas.thauvin at dalibo.com
Tue May 17 15:08:56 UTC 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
When in daemon mode, connection hangs when using md5 authentication
method. The child process in charge of the client goes into an infinite
loop in pool_get_passwd() while trying to read the pool_passwd file.
The cause of the problem comes from the daemonize() function that closes
all file descriptors starting from 3, including the file descriptor of
the pool_passwd file. When pgpool gets to pool_get_passwd, the null
checks on the passwd_fd variable fail because the variable was not reset
to a NULL value.
The possible solution to this issue is to find and open the pool_passwd
file after becoming a daemon. Please find the corresponding patch
attached based on the pgpool-II V3_0_STABLE branch.
Here are some informations on the status of pgpool-II while
investigating the issue :
$ ps xf
29960 ? Ss 0:00 pgpool -f
/home/pgsql/pgpool-3.0_stable/etc/pgpool.conf -d
29961 ? T 0:35 \_ pgpool: accept connection
29962 ? S 0:00 \_ pgpool: wait for connection request
29963 ? S 0:00 \_ pgpool: wait for connection request
29964 ? S 0:00 \_ pgpool: wait for connection request
29965 ? S 0:00 \_ pgpool: PCP: wait for connection request
29966 ? S 0:00 \_ pgpool: worker process
$ gdb --pid=29961
(gdb) bt
#0 0x00007f5fc98faea0 in read () from /lib/libc.so.6
#1 0x00007f5fc98a5db8 in _IO_file_underflow () from /lib/libc.so.6
#2 0x00007f5fc98a749e in _IO_default_uflow () from /lib/libc.so.6
#3 0x00007f5fc989e97b in getc () from /lib/libc.so.6
#4 0x0000000000447b6e in pool_get_passwd (username=0x22ef620
"postgres") at pool_passwd.c:171
#5 0x0000000000433cc4 in CheckMd5Auth (frontend=0x22f3270) at
pool_hba.c:1453
#6 ClientAuthentication (frontend=0x22f3270) at pool_hba.c:223
#7 0x0000000000409980 in do_child (unix_fd=<value optimized out>,
inet_fd=<value optimized out>)
at child.c:244
#8 0x0000000000403e85 in fork_a_child (unix_fd=3, inet_fd=4, id=0) at
main.c:1032
#9 0x0000000000406c0a in main (argc=<value optimized out>, argv=<value
optimized out>) at main.c:516
$ lsof -p 29961
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
pgpool 29961 orgrim cwd DIR 254,1 1024 2 /
pgpool 29961 orgrim rtd DIR 254,1 1024 2 /
pgpool 29961 orgrim txt REG 254,6 2338135 2629903
/home/pgsql/pgpool-3.0_stable/bin/pgpool
pgpool 29961 orgrim mem REG 254,2 93936 390944
/usr/lib/libz.so.1.2.3.4
pgpool 29961 orgrim mem REG 254,1 14696 65843
/lib/libdl-2.11.2.so
pgpool 29961 orgrim mem REG 254,1 131260 65898
/lib/libpthread-2.11.2.so
pgpool 29961 orgrim mem REG 254,2 1853320 423215
/usr/lib/libcrypto.so.1.0.0
pgpool 29961 orgrim mem REG 254,2 337216 423216
/usr/lib/libssl.so.1.0.0
pgpool 29961 orgrim mem REG 254,1 1432968 65793
/lib/libc-2.11.2.so
pgpool 29961 orgrim mem REG 254,1 530736 65846
/lib/libm-2.11.2.so
pgpool 29961 orgrim mem REG 254,1 89064 65849
/lib/libnsl-2.11.2.so
pgpool 29961 orgrim mem REG 254,1 80712 65899
/lib/libresolv-2.11.2.so
pgpool 29961 orgrim mem REG 254,1 35104 65795
/lib/libcrypt-2.11.2.so
pgpool 29961 orgrim mem REG 254,6 87933 2629886
/home/pgsql/pgpool-3.0_stable/lib/libpcp.so.0.0.0
pgpool 29961 orgrim mem REG 254,6 180785 2627322
/home/pgsql/postgresql-9.0.4/lib/libpq.so.5.3
pgpool 29961 orgrim mem REG 254,1 128744 65624
/lib/ld-2.11.2.so
pgpool 29961 orgrim mem REG 0,4 360451
/VE0-SYSV00000000 (stat: No such file or directory)
pgpool 29961 orgrim mem REG 0,4 458758
/VE0-SYSV00000000 (stat: No such file or directory)
pgpool 29961 orgrim mem REG 0,4 425989
/VE0-SYSV00000000 (stat: No such file or directory)
pgpool 29961 orgrim mem REG 0,4 393220
/VE0-SYSV00000000 (stat: No such file or directory)
pgpool 29961 orgrim mem REG 0,4 327682
/VE0-SYSV00000000 (stat: No such file or directory)
pgpool 29961 orgrim 0u CHR 1,3 0t0 1400
/dev/null
pgpool 29961 orgrim 1u CHR 1,3 0t0 1400
/dev/null
pgpool 29961 orgrim 2u CHR 1,3 0t0 1400
/dev/null
pgpool 29961 orgrim 3u unix 0xffff8801343d7840 0t0 162244
/tmp/.s.PGSQL.9999
pgpool 29961 orgrim 4u IPv4 162246 0t0 TCP
*:9999 (LISTEN)
pgpool 29961 orgrim 5u IPv4 162443 0t0 TCP
localhost:9999->localhost:45603 (ESTABLISHED)
- --
Nicolas Thauvin
DBA
http://www.dalibo.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJN0o+IAAoJEDa2VZzWZKpNFUgQAKIsiJMEshF6zagFqsC+JAec
0RhZnP2/ctueVUrZMfBEZpOH0ENEbU/bCfoGvb9+40EJ2QAJIve2lzEolt9rmYjg
c+QTCfLEb+bOl0HCP4I6OCgSVshTnpNlny0ESkxD3nOhyQQainA0LBXCPMajN+RC
FA3F7rS388SQcDcf88JhkyETwvyxjymedhJVGjQqUh2CsytF7wCgYqigE3jMrsiu
KkX9RoHPGgreywZnKCJf8MjDcpoe6ytiDVftRI4h9pVBLm1I7G1CznsCC3TWhbiw
H/dflJqFygDKLr2Gyyho/uHczGS3tJTDRzrFUqK6Iu3ApcB+ULO2x6MJ1hul5wDG
qR0sf3mEN6pC6obUlBpNNU2vk8DovcDisxsh4IjaovvUPic7aAysRK7Uh1BjqChS
J4ZvNEzZwzNMgcd7bYKTdNfWHxnSyB6kUvQIpT/uj9DnBfBteIY+5zdnixWbgoes
tjsS3v1Ei+VKow1Foz+8Py94m9jLngQjCzq9jyM7Ts4yONtoFuCccZfgKtc000UL
l78LqfsriMUp/bdpFIBRmEu//TSHK9X9Cg9BniaMEfAqEijJV2YNYpagZl0JeIDr
iFni7n5tj6cxugbq9EMzD1S12FV+3tu6LXlFQ3ExmPdU29V5M0EKQbA89l22V4OL
qzx6tDKX/j0Ey3m7TJ6U
=LqwK
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_md5_auth_hang_in_daemon_mode.patch
Type: text/x-patch
Size: 1330 bytes
Desc: not available
URL: <http://pgfoundry.org/pipermail/pgpool-hackers/attachments/20110517/f89fb14f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_md5_auth_hang_in_daemon_mode.patch.sig
Type: application/octet-stream
Size: 543 bytes
Desc: not available
URL: <http://pgfoundry.org/pipermail/pgpool-hackers/attachments/20110517/f89fb14f/attachment.obj>
More information about the Pgpool-hackers
mailing list