pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
R: R: R: R: BUG #6342: libpq blocks forever in "poll" function
3+ messages / 3 participants
[nested] [flat]

* R: R: R: R: BUG #6342: libpq blocks forever in "poll" function
@ 2011-12-20 17:28  Andrea Grassi <andreagrassi@sogeasoft.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Andrea Grassi @ 2011-12-20 17:28 UTC (permalink / raw)
  To: 'Tom Lane' <tgl@sss.pgh.pa.us>; +Cc: harrywr2@comcast.net; 'Craig Ringer' <ringerc@ringerc.id.au>; pgsql-bugs; 'Alvaro Herrera' <alvherre@commandprompt.com>

This is the server side stack kept by gdb:

(gdb) bt full
#0  0x00002b6488588ae5 in recv () from /lib64/libc.so.6
No symbol table info available.
#1  0x0000000000550cd2 in secure_read ()
No symbol table info available.
#2  0x00000000005563a4 in pq_recvbuf ()
No symbol table info available.
#3  0x00000000005567a7 in pq_getbyte ()
No symbol table info available.
#4  0x00000000005d33e6 in PostgresMain ()
No symbol table info available.
#5  0x00000000005a9708 in ServerLoop ()
No symbol table info available.
#6  0x00000000005aa2b7 in PostmasterMain ()
No symbol table info available.
#7  0x00000000005580be in main ()
No symbol table info available.

The netstat command on client and server connection has this output:
The first line should be the server, the second the client.

Proto Recv-Q Send-Q Local Address           Foreign Address         State
PID/Program name
tcp        0      0 127.0.0.1:5432          127.0.0.1:53129
ESTABLISHED -
tcp       48      0 127.0.0.1:53129         127.0.0.1:5432
ESTABLISHED 29802/g_mrprun.e


Regards, Andrea

-----Messaggio originale-----
Da: Tom Lane [mailto:tgl@sss.pgh.pa.us] 
Inviato: martedì 20 dicembre 2011 17.38
A: Andrea Grassi
Cc: harrywr2@comcast.net; 'Craig Ringer'; 'Pg Bugs'; 'Alvaro Herrera'
Oggetto: Re: R: R: R: [BUGS] BUG #6342: libpq blocks forever in "poll"
function 

"Andrea Grassi" <andreagrassi@sogeasoft.com> writes:
> #0  0xffffe410 in __kernel_vsyscall ()
> No symbol table info available.
> #1  0xf76539cb in poll () from /lib/libc.so..
> #2  0xf770d39a in pqSocketCheck () from /home/pg/pgsql/lib-32/libpq.so.5 
> #3  0xf770d49d in pqWaitTimed () from /home/pg/pgsql/lib-32/libpq.so.5 
> #4  0xf770d513 in pqWait () from /home/pg/pgsql/lib-32/libpq.so.5 
> #5  0xf770c6d6 in PQgetResult () from /home/pg/pgsql/lib-32/libpq.so.5 
> #6  0xf770c89c in PQexecFinish () from /home/pg/pgsql/lib-32/libpq.so.5 

What about a stack trace from the connected server process?  libpq
clearly thinks it's waiting for a message from the server, but I wonder
what the server thinks.  Also, what connection status does netstat
show on each side?

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: R: R: R: R: BUG #6342: libpq blocks forever in "poll" function
@ 2011-12-20 17:42  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Andrea Grassi <andreagrassi@sogeasoft.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2011-12-20 17:42 UTC (permalink / raw)
  To: Andrea Grassi <andreagrassi@sogeasoft.com>; +Cc: harrywr2@comcast.net; 'Craig Ringer' <ringerc@ringerc.id.au>; pgsql-bugs; 'Alvaro Herrera' <alvherre@commandprompt.com>

"Andrea Grassi" <andreagrassi@sogeasoft.com> writes:
> This is the server side stack kept by gdb:
> [ server is waiting to receive something from client ]

> The netstat command on client and server connection has this output:
> The first line should be the server, the second the client.

> Proto Recv-Q Send-Q Local Address           Foreign Address         State
> PID/Program name
> tcp        0      0 127.0.0.1:5432          127.0.0.1:53129
> ESTABLISHED -
> tcp       48      0 127.0.0.1:53129         127.0.0.1:5432
> ESTABLISHED 29802/g_mrprun.e

Hrm.  What's with the 48 bytes in the client's receive queue?  Surely
the kernel should be reporting that the socket is read-ready, if it's
got some data.  I think you've found an obscure kernel bug ---- somehow
it's failing to wake the poll() caller.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: R: R: R: R: BUG #6342: libpq blocks forever in "poll" function
@ 2011-12-20 23:56  Craig Ringer <ringerc@ringerc.id.au>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Craig Ringer @ 2011-12-20 23:56 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andrea Grassi <andreagrassi@sogeasoft.com>; harrywr2@comcast.net; pgsql-bugs; Alvaro Herrera <alvherre@commandprompt.com>

On 21/12/2011 1:42 AM, Tom Lane wrote:
> Hrm.  What's with the 48 bytes in the client's receive queue?  Surely
> the kernel should be reporting that the socket is read-ready, if it's
> got some data.  I think you've found an obscure kernel bug ---- somehow
> it's failing to wake the poll() caller.
>
I've been leaning that way too; that's why I was asking him for 
/proc/$pid/stack and `wchan -C programname -o wchan:80=` output - to get 
some idea of what function in the kernel it's sitting in.

Unfortunately the OP is on some enterprise distro that doesn't have 
/proc/$pid/stack . wchan info would still be useful. I wonder how old 
their kernel is? The bug could've already been fixed. /proc/pid/stack 
has been around since 2008 so it must be pretty elderly.

OP: You can also get a kernel stack for a process by enabling the magic 
SysRQ key (see Google) then using Alt-SysRq-T . This requires a physical 
keyboard directly connected to the server. It emits the stack 
information via dmesg. See:

http://en.wikipedia.org/wiki/Magic_SysRq_key

There's a "sysrqd" that apparently lets you use these features remotely, 
but I've never tried it.

--
Craig Ringer



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-12-20 23:56 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-12-20 17:28 R: R: R: R: BUG #6342: libpq blocks forever in "poll" function Andrea Grassi <andreagrassi@sogeasoft.com>
2011-12-20 17:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-12-20 23:56   ` Craig Ringer <ringerc@ringerc.id.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox