PQexec does not return.

From: Steve Martin <smartin(at)nec(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: PQexec does not return.
Date: 2007-01-14 20:44:06
Message-ID: 45AA9616.90000@nec.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

We have an intermittent problem where PQexec does not seem to return
even though the server seems to have sent the results.

From the gdb output , the sql statement can be seen, and from the log,
the result can be seen to be sent. Both process are running on the same
machine. Version of postgres and other info:

1. Postgres Version 8.1.4
2. Machine HP rx4640
3. OS: HPUX 11.23
4. Mem 8G

Has anyone seen this type of problem before, can it be cause by a TCP/IP
communication failure?

From gdb:

% /opt/langtools/bin/gdb /path/name -p 3587
HP gdb 5.2 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 5.2 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for
warranty/support.
..
Attaching to program: /path/name, process 3587

warning: No unwind information found.
Skipping this library /usr/lib/hpux32/libcl.so.1.

0x60000000c0342810:0 in _poll_sys+0x30 () from /usr/lib/hpux32/libc.so.1
(gdb) bt
#0 0x60000000c0342810:0 in _poll_sys+0x30 () from
/usr/lib/hpux32/libc.so.1
#1 0x60000000c03553e0:0 in poll+0x160 () from /usr/lib/hpux32/libc.so.1
#2 0x60000000cefa75b0:0 in pqSocketCheck+0xb00 ()
from /usr/local/pgsql/lib/libpq.so.4
#3 0x60000000cefa77c0:0 in pqWaitTimed+0x40 ()
from /usr/local/pgsql/lib/libpq.so.4
#4 0x60000000cefa7890:0 in pqWait+0x40 () from
/usr/local/pgsql/lib/libpq.so.4
#5 0x60000000cefa53b0:0 in PQgetResult+0x180 ()
from /usr/local/pgsql/lib/libpq.so.4
#6 0x60000000cefa56f0:0 in PQexecFinish+0x40 ()
from /usr/local/pgsql/lib/libpq.so.4
#7 0x60000000c1c83870:0 in DBIFPostgreSelect::getRecord
(this=0x40114840)
at DBIFPostgre.C:1688
#8 0x60000000c1c73d20:0 in DBIFPostgreSelect::selectNext
(this=0x40114840,
rst=(at)0x7fff5210) at DBIFPostgre.C:1902
#9 0x60000000c1c64b90:0 in DBIFSelect::selectNext (this=0x7fff5240,
rst=(at)0x7fff5210) at DBIF.C:2704
#10 0x404ff00:0 in TableStatus::checkDeferredTR (this=0x403104c0)
at DbSContTable.C:1468
#11 0x405b430:0 in TableStatusManager::checkDeferredTR (this=0x400bde90)
at DbSContTable.C:3146
#12 0x4068960:0 in Controller::go (this=0x7fffc320) at
DbSController.C:1950
#13 0x406b1b0:0 in main (argc=1, argv=0x7fffed74) at DbSContMain.C:137
(gdb) q
The program is running. Quit anyway (and detach it)? (y or n) y
Detaching from program: /path/name, process 3587

% /opt/langtools/bin/gdb /path/name -p 3587
HP gdb 5.2 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 5.2 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for
warranty/support.
..
Attaching to program: /path/name, process 3587

warning: No unwind information found.
Skipping this library /usr/lib/hpux32/libcl.so.1.

0x60000000c0342810:0 in _poll_sys+0x30 () from /usr/lib/hpux32/libc.so.1
(gdb) up
#1 0x60000000c03553e0:0 in poll+0x160 () from /usr/lib/hpux32/libc.so.1
(gdb) up
#2 0x60000000cefa75b0:0 in pqSocketCheck+0xb00 ()
from /usr/local/pgsql/lib/libpq.so.4
(gdb) up
#3 0x60000000cefa77c0:0 in pqWaitTimed+0x40 ()
from /usr/local/pgsql/lib/libpq.so.4
(gdb) up
#4 0x60000000cefa7890:0 in pqWait+0x40 () from
/usr/local/pgsql/lib/libpq.so.4
(gdb) up
#5 0x60000000cefa53b0:0 in PQgetResult+0x180 ()
from /usr/local/pgsql/lib/libpq.so.4
(gdb) up
#6 0x60000000cefa56f0:0 in PQexecFinish+0x40 ()
from /usr/local/pgsql/lib/libpq.so.4
(gdb) up
#7 0x60000000c1c83870:0 in DBIFPostgreSelect::getRecord
(this=0x40114840)
at DBIFPostgre.C:1688
1688 myResultExecPrepare =
PQexec(myConnection->conn, seleStmt);
(gdb) p seleStmt
$1 = "SELECT * FROM T_AM_TERM_BILLING WHERE (TR_STATUS = 'DEFERRED')
AND ((DOWNLOAD_DATE < 20070108) OR ((DOWNLOAD_DATE = 20070108) AND
(DOWNLOAD_TIME < 203744)))", '\000' <repeats 43 times>
(gdb) q
The program is running. Quit anyway (and detach it)? (y or n) y
Detaching from program: /path/name, process 3587

From postgres log

2007-01-08 20:37:44.839 NZDT ain(at)[local]%smf>LOG: statement: select
pg_get_indexdef(indexrelid) from pg_index where ind
relid = ( select oid from pg_class where relname =
't_am_registration_db')
2007-01-08 20:37:44.840 NZDT ain(at)[local]%smf>LOG: duration: 0.347 ms
2007-01-08 20:37:44.840 NZDT ain(at)[local]%smf>LOG: statement: SELECT
* FROM T_AM_REGISTRATION_DB WHERE (TR_STATUS = 'DEF
ERRED') AND ((DOWNLOAD_DATE < 20070108) OR ((DOWNLOAD_DATE =
20070108) AND (DOWNLOAD_TIME < 203744)))
2007-01-08 20:37:44.841 NZDT ain(at)[local]%smf>LOG: duration: 0.792 ms
2007-01-08 20:37:44.841 NZDT ain(at)[local]%smf>LOG: statement: select
attname, attnotnull, atttypid, atttypmod, format_ty
pe(atttypid, atttypmod) as data_type from pg_attribute where attnum
> 0 and atttypid > 0 and attrelid = ( select oid fro
m pg_class where relname = 't_am_term_billing') order by attnum
2007-01-08 20:37:44.842 NZDT ain(at)[local]%smf>LOG: duration: 0.778 ms
2007-01-08 20:37:44.842 NZDT ain(at)[local]%smf>LOG: statement: select
pg_get_indexdef(indexrelid) from pg_index where ind
relid = ( select oid from pg_class where relname = 't_am_term_billing')
2007-01-08 20:37:44.842 NZDT ain(at)[local]%smf>LOG: duration: 0.346 ms
2007-01-08 20:37:44.842 NZDT ain(at)[local]%smf>LOG: statement: SELECT
* FROM T_AM_TERM_BILLING WHERE (TR_STATUS = 'DEFERRED') AND
((DOWNLOAD_DATE < 20070108) OR ((DOWNLOAD_DATE = 20070108) AND
(DOWNLOAD_TIME < 203744)))
2007-01-08 20:37:44.843 NZDT ain(at)[local]%smf>LOG: duration: 1.165 ms
2007-01-08 20:50:02.026 NZDT @%>LOG: autovacuum: processing
database "template1"
2007-01-08 21:50:02.036 NZDT @%>LOG: autovacuum: processing
database "smf"
2007-01-08 22:50:02.084 NZDT @%>LOG: autovacuum: processing
database "postgres"
2007-01-08 23:50:02.104 NZDT @%>LOG: autovacuum: processing
database "template1"
2007-01-09 00:40:01.090 NZDT [unknown](at)%[unknown]>LOG: connection
received: host=[local]
2007-01-09 00:40:01.091 NZDT ain(at)[local]%smf>LOG: connection
authorized: user=ain database=smf
2007-01-09 00:40:01.093 NZDT ain(at)[local]%smf>LOG: statement: select
attname, attnotnull, atttypid, atttypmod, format_ty
pe(atttypid, atttypmod) as data_type from pg_attribute where attnum
> 0 and atttypid > 0 and attrelid = ( select oid fro
m pg_class where relname = 'com_node_host') order by attnum
2007-01-09 00:40:01.097 NZDT ain(at)[local]%smf>LOG: duration: 3.788 ms

Regards
Steve Martin

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ksherlock 2007-01-14 23:26:03 Re: like query backslash
Previous Message Doug Cole 2007-01-14 20:29:54 Avoiding empty queries in tsearch