[pgpool-committers: 1140] pgpool: Fix bug reported in bug #62 (main process segfault).

Tatsuo Ishii ishii at postgresql.org
Sat Jul 20 12:45:16 JST 2013


Fix bug reported in bug #62 (main process segfault).

The bug report showed main process died after the log:

Jun 22 10:23:20 pgpool[32629]: pool_read: read failed (Connection reset by peer)
Jun 22 10:23:20 pgpool[32629]: notice_backend_error: called from pgpool main. ignored.
Jun 22 10:23:20 pgpool[32629]: child_exit: called from pgpool main. ignored.
Jun 22 10:23:20 kernel: [11850568.371509] pgpool[32629]: segfault at 6f0ff2 ip 00007fbd7ed9811f sp 00007fff27275f08 error 4 in libc-2.15.so[7fbd7ec49000+1b5000]

This indicates that after reading from socket while health checking
failed, it tried to initiate failover by calling notice_backend_error,
which is not appropriate because that should be handled in the health
check logic. So it is ignored. So far so good. pool_read called
child_exit after that and again it was ignored. This is also
good. Problem is, it continued to run with undefined read length from
read(2). Finally pool_read call memmove with the undefined length to
update its internal buffer, which could cause segfault depending on
the value of the read length.

Fix is, after child_exit, return with -1 to indicate error was
happened. Also I fixed the code after pool_check_fd fails. Before it
just exits process, which is never good for pgpool main
process. Although I don't think the case ever happened because I never
saw single error report which showed the case.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=7c09d884b94635e85a8fdb8b049381314309a000

Modified Files
--------------
pool_stream.c |    9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)



More information about the pgpool-committers mailing list