[pgpool-committers: 4434] Re: pgpool: Fix for re-sync logic in reading packet from backend.

Tatsuo Ishii ishii at sraoss.co.jp
Thu Dec 21 14:56:31 JST 2017


For a record, here is the stack trace when the bug occurs.

#0  0x00007f2ea1b6a573 in __select_nocancel () at ../sysdeps/unix/syscall-template.S:84
#1  0x00000000004263e7 in pool_check_fd (cp=cp at entry=0x1a4dd80) at protocol/pool_process_query.c:647
#2  0x0000000000426726 in pool_check_fd (cp=cp at entry=0x1a4dd80) at protocol/pool_process_query.c:679
#3  0x000000000045761b in pool_read (cp=0x1a4dd80, buf=buf at entry=0x7ffd75268bf5, len=len at entry=1)
    at utils/pool_stream.c:163
#4  0x000000000042ba63 in read_kind_from_backend (frontend=frontend at entry=0x1a6a378, 
    backend=backend at entry=0x1a58358, decided_kind=decided_kind at entry=0x7ffd75269002 "\245\061")
    at protocol/pool_process_query.c:3268
#5  0x000000000043772c in ProcessBackendResponse (frontend=frontend at entry=0x1a6a378, 
    backend=backend at entry=0x1a58358, state=state at entry=0x7ffd7526928c, num_fields=num_fields at entry=0x7ffd7526928a)
    at protocol/pool_proto_modules.c:2528
#6  0x000000000042a209 in read_packets_and_process (frontend=frontend at entry=0x1a6a378, 
    backend=backend at entry=0x1a58358, reset_request=reset_request at entry=0, state=state at entry=0x7ffd7526928c, 
    num_fields=num_fields at entry=0x7ffd7526928a, cont=cont at entry=0x7ffd75269294 "\001")
    at protocol/pool_process_query.c:4752
#7  0x000000000042ad6b in pool_process_query (frontend=0x1a6a378, backend=0x1a58358, 
    reset_request=reset_request at entry=0) at protocol/pool_process_query.c:274
#8  0x0000000000425111 in do_child (fds=fds at entry=0x1a463a0) at protocol/child.c:381
#9  0x0000000000409ad5 in fork_a_child (fds=0x1a463a0, id=5) at main/pgpool_main.c:759
#10 0x000000000040acde in reaper () at main/pgpool_main.c:2515
#11 0x000000000040d85d in pool_sleep (second=<optimized out>) at main/pgpool_main.c:2731
#12 0x000000000040fa7f in PgpoolMain (discard_status=discard_status at entry=1 '\001', 
    clear_memcache_oidmaps=clear_memcache_oidmaps at entry=0 '\000') at main/pgpool_main.c:540
#13 0x00000000004081a5 in main (argc=<optimized out>, argv=<optimized out>) at main/main.c:317

Also here is a pgproto.data. I see the bug after 10-200 times iteration.

'Q'	"SET statement_timeout = '4s'"

# Receive response from backend
'Y'

'P'	"S1"	"SELECT 1/0"	0
'B'	""	"S1"	0	0	0
'E'	""	0
'C'	'S'	"S1"

'P'	"S2"	"SELECT * from pg_tables"	0
'B'	""	"S2"	0	0	0
'E'	""	0
'C'	'S'	"S2"

# Issue Sync message
'S'

# Receive response from backend
'Y'

'P'	""	"SELECT * from pg_tables"	0
'B'	""	""	0	0	0
'E'	""	0
#'C'	'S'	""
'S'
'Y'
# Send terminate message
'X'

From: Tatsuo Ishii <ishii at postgresql.org>
Subject: [pgpool-committers: 4397] pgpool: Fix for re-sync logic in reading packet from backend.
Date: Tue, 12 Dec 2017 07:24:16 +0000
Message-ID: <E1eOevI-0000Cp-KT at gothos.postgresql.org>

> Fix for re-sync logic in reading packet from backend.
> 
> read_kind_from_backend(), which reads message kind from backend,
> re-syncs backend nodes when a ready for query message is
> received. Unfortunately it forgot to call
> pool_pending_message_pull_out() to delete sync pending message. This
> leads to random stuck while reading packets from backend. Fix this to
> call pool_pending_message_pull_out().
> 
> Branch
> ------
> master
> 
> Details
> -------
> https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=cf0bb90d751ea10354953749f02a45e73ada0c32
> 
> Modified Files
> --------------
> src/protocol/pool_process_query.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
> 


More information about the pgpool-committers mailing list