Re: BUG #1131: PQfinish hangs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Walter Lübker <w(dot)luebker(at)t-online(dot)de>
Cc: pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: BUG #1131: PQfinish hangs
Date: 2004-04-13 16:11:04
Message-ID: 23483.1081872664@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Walter =?iso-8859-1?q?L=FCbker?= <w(dot)luebker(at)t-online(dot)de> writes:
> here the stack trace:
> (gdb) bt
> #0 0x401e0f1a in malloc_consolidate () from /lib/libc.so.6
> #1 0x401e0e4f in _int_free () from /lib/libc.so.6
> #2 0x401dfa5f in free () from /lib/libc.so.6
> #3 0x40132fda in freePGconn () from /usr/lib/libpq.so.3
> #4 0x4009cb9f in pg_sql_dende (db=0x83a3f40) at pg_sql.c:830
> #5 0x4005a3d8 in cende (db=0x83a3f40) at dvs.c:3497
> #6 0x400761ec in dende (fbank=0xbfffe2f0, fin_err=0xbfffe48c, flu=0xbfffe454,
> fnode=0xbfffe456) at fdvs.c:1533
> #7 0x0805a595 in main ()

Okay, so the hang is really inside free(). This is a pretty strong
indication that something has clobbered the memory allocation data
structures used by malloc/free. Usually this happens because some
bit of code writes past the end of a chunk of memory it's requested
from malloc --- ie, overruns the buffer size it requested. The point
at which you notice a problem is likely to be far removed from the
place where the error actually is.

It's possible that the overrun bug is in libpq, but it seems much
more likely that it's your own bug. What I'd suggest is that you
rebuild your program with a debugging malloc package (ElectricFence
or dmalloc or one of the other dozen or so that are out there) and
see if it can't pinpoint the problem for you.

If you do find that the error is in libpq, then by all means let us
know ;-). But the odds are it isn't.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Juris Krumins 2004-04-14 09:35:43 cache lookup of relation 165058647 failed
Previous Message Tom Lane 2004-04-13 15:40:30 Re: BUG #1130: server terminated by signal 11 (easy to duplicate)