Re: Help debugging a hung postgresql client connection

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Venkatraju T(dot)V(dot)" <venkatraju(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Help debugging a hung postgresql client connection
Date: 2007-04-23 17:23:09
Message-ID: 10597.1177348989@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Venkatraju T.V." <venkatraju(at)gmail(dot)com> writes:
> The backtrace for the postgresql backend process at that time:
> (gdb) bt
> #0 0x000000321e6cc5e5 in recv () from /lib64/libc.so.6
> #1 0x00000000005004f6 in secure_read (port=0xa0e0f0, ptr=0x7dc8c0,
> len=8192) at /usr/include/bits/socket2.h:35
> #2 0x0000000000506114 in pq_recvbuf () at pqcomm.c:697
> #3 0x0000000000506537 in pq_getbyte () at pqcomm.c:738
> #4 0x00000000005688b7 in PostgresMain (argc=4, argv=0x9ef7d8,
> username=0x9ef7a0 "user") at postgres.c:289

This backend is waiting for input from the client; it doesn't think it's
in the middle of an operation. It looks to me like this is a
client-side problem, unless you want to believe that the network lost
the last response sent to the client.

> libpq is built with thread-safety as far as I can tell -
> #define ENABLE_THREAD_SAFETY 1
> in /usr/include/pg_config_x86_64.h

Thread-safety or not, libpq does not by itself provide any interlocking
to make it safe for multiple threads to use the same PQconn. A
multi-thread client needs to either use a separate DB connection per
thread, or introduce its own mutex for a shared PQconn. If you're not
doing either of those, this is probably a problem with multiple threads
messing up the state of the PQconn.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pat Maddox 2007-04-23 17:49:59 Setting table ids in slony
Previous Message Tilmann Singer 2007-04-23 17:16:59 Re: tsearch2 dictionary that indexes substrings?