Re: [GENERAL] PQexec does not return.

2007-01-29 Thread shalendra . tripathi
Hi Martin,

I have got same problem as mentioned by you. As per your comment it 
seems this problem is due to memory leak. Could you explain the exact 
reason of this problem. How it is related to mem-leak.

Regards  Thanks
-Shalendra

On Jan 15, 3:51 pm, [EMAIL PROTECTED] (Steve Martin) wrote:
   Hi All,

 Found the problem.  This was caused by a memory leak in our application.

 Regards
 Steve Martin

 Steve Martin wrote:
  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.

  0x6000c0342810:0 in _poll_sys+0x30 () from
  /usr/lib/hpux32/libc.so.1
  (gdb) bt
  #0  0x6000c0342810:0 in _poll_sys+0x30 () from
  /usr/lib/hpux32/libc.so.1
  #1  0x6000c03553e0:0 in poll+0x160 () from
  /usr/lib/hpux32/libc.so.1
  #2  0x6000cefa75b0:0 in pqSocketCheck+0xb00 ()
 from /usr/local/pgsql/lib/libpq.so.4
  #3  0x6000cefa77c0:0 in pqWaitTimed+0x40 ()
 from /usr/local/pgsql/lib/libpq.so.4
  #4  0x6000cefa7890:0 in pqWait+0x40 () from
  /usr/local/pgsql/lib/libpq.so.4
  #5  0x6000cefa53b0:0 in PQgetResult+0x180 ()
 from /usr/local/pgsql/lib/libpq.so.4
  #6  0x6000cefa56f0:0 in PQexecFinish+0x40 ()
 from /usr/local/pgsql/lib/libpq.so.4
  #7  0x6000c1c83870:0 in DBIFPostgreSelect::getRecord
  (this=0x40114840)
  at DBIFPostgre.C:1688
  #8  0x6000c1c73d20:0 in DBIFPostgreSelect::selectNext
  (this=0x40114840,
  [EMAIL PROTECTED]) at DBIFPostgre.C:1902
  #9  0x6000c1c64b90:0 in DBIFSelect::selectNext (this=0x7fff5240,
  [EMAIL PROTECTED]) 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.

  0x6000c0342810:0 in _poll_sys+0x30 () from
  /usr/lib/hpux32/libc.so.1
  (gdb) up
  #1  0x6000c03553e0:0 in poll+0x160 () from
  /usr/lib/hpux32/libc.so.1
  (gdb) up
  #2  0x6000cefa75b0:0 in pqSocketCheck+0xb00 ()
 from /usr/local/pgsql/lib/libpq.so.4
  (gdb) up
  #3  0x6000cefa77c0:0 in pqWaitTimed+0x40 ()
 from /usr/local/pgsql/lib/libpq.so.4
  (gdb) up
  #4  0x6000cefa7890:0 in pqWait+0x40 () from
  /usr/local/pgsql/lib/libpq.so.4
  (gdb) up
  #5  0x6000cefa53b0:0 in PQgetResult+0x180 ()
 from /usr/local/pgsql/lib/libpq.so.4
  (gdb) up
  #6  0x6000cefa56f0:0 in PQexecFinish+0x40 ()
 from /usr/local/pgsql/lib/libpq.so.4
  (gdb) up
  #7  0x6000c1c83870:0 in DBIFPostgreSelect::getRecord
  (this=0x40114840)
  at DBIFPostgre.C:1688
  1688myResultExecPrepare =
  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 

Re: [GENERAL] PQexec does not return.

2007-01-15 Thread Steve Martin

 Hi All,

Found the problem.  This was caused by a memory leak in our application.

Regards
Steve Martin


Steve Martin wrote:


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.

0x6000c0342810:0 in _poll_sys+0x30 () from
/usr/lib/hpux32/libc.so.1
(gdb) bt
#0  0x6000c0342810:0 in _poll_sys+0x30 () from
/usr/lib/hpux32/libc.so.1
#1  0x6000c03553e0:0 in poll+0x160 () from
/usr/lib/hpux32/libc.so.1
#2  0x6000cefa75b0:0 in pqSocketCheck+0xb00 ()
   from /usr/local/pgsql/lib/libpq.so.4
#3  0x6000cefa77c0:0 in pqWaitTimed+0x40 ()
   from /usr/local/pgsql/lib/libpq.so.4
#4  0x6000cefa7890:0 in pqWait+0x40 () from
/usr/local/pgsql/lib/libpq.so.4
#5  0x6000cefa53b0:0 in PQgetResult+0x180 ()
   from /usr/local/pgsql/lib/libpq.so.4
#6  0x6000cefa56f0:0 in PQexecFinish+0x40 ()
   from /usr/local/pgsql/lib/libpq.so.4
#7  0x6000c1c83870:0 in DBIFPostgreSelect::getRecord
(this=0x40114840)
at DBIFPostgre.C:1688
#8  0x6000c1c73d20:0 in DBIFPostgreSelect::selectNext
(this=0x40114840,
[EMAIL PROTECTED]) at DBIFPostgre.C:1902
#9  0x6000c1c64b90:0 in DBIFSelect::selectNext (this=0x7fff5240,
[EMAIL PROTECTED]) 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.

0x6000c0342810:0 in _poll_sys+0x30 () from
/usr/lib/hpux32/libc.so.1
(gdb) up
#1  0x6000c03553e0:0 in poll+0x160 () from
/usr/lib/hpux32/libc.so.1
(gdb) up
#2  0x6000cefa75b0:0 in pqSocketCheck+0xb00 ()
   from /usr/local/pgsql/lib/libpq.so.4
(gdb) up
#3  0x6000cefa77c0:0 in pqWaitTimed+0x40 ()
   from /usr/local/pgsql/lib/libpq.so.4
(gdb) up
#4  0x6000cefa7890:0 in pqWait+0x40 () from
/usr/local/pgsql/lib/libpq.so.4
(gdb) up
#5  0x6000cefa53b0:0 in PQgetResult+0x180 ()
   from /usr/local/pgsql/lib/libpq.so.4
(gdb) up
#6  0x6000cefa56f0:0 in PQexecFinish+0x40 ()
   from /usr/local/pgsql/lib/libpq.so.4
(gdb) up
#7  0x6000c1c83870:0 in DBIFPostgreSelect::getRecord
(this=0x40114840)
at DBIFPostgre.C:1688
1688myResultExecPrepare =
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 [EMAIL PROTECTED]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 [EMAIL PROTECTED]LOG:  duration: 0.347 ms