Re: Multi-threaded user app segfaults when using libpq with separate connections

From: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Multi-threaded user app segfaults when using libpq with separate connections
Date: 2003-08-05 21:45:21
Message-ID: 200308052345.21967.ftm.van.vugt@foxi.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

> I get the impression that
> something is clobbering memory with abandon. Do you have any
> Purify-like tools to look for memory stomp problems?

In addition to my post of this morning containing the regular Valgrind output,
I'm including here the relevant parts of a valgrind run using the 'helgrind'
skin, which detects possible data race conditions.

I hope the info is of some use,

best,

Frank van Vugt

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

==14670==
==14670== Thread 2:
==14670== Possible data race writing variable at 0x43C561A8
==14670== at 0x40EB48D7: enlargePQExpBuffer (pqexpbuffer.c:152)
==14670== by 0x40EB4994: printfPQExpBuffer (pqexpbuffer.c:203)
==14670== by 0x40EB168B: pqReadData (fe-misc.c:449)
==14670== by 0x40EAF334: PQgetResult (fe-exec.c:1337)
==14670== Address 0x43C561A8 is 456 bytes inside a block of size 16384
alloc'd by thread 3
==14670== at 0x4001CA2C: malloc (vg_replace_malloc.c:153)
==14670== by 0x40EABF44: makeEmptyPGconn (fe-connect.c:1881)
==14670== by 0x40EAA319: PQconnectStart (fe-connect.c:273)
==14670== by 0x40EAA2D5: PQconnectdb (fe-connect.c:235)
==14670== Previous state: shared RO, no locks
==14670==
==14670== Thread 2:
==14670== Possible data race writing variable at 0x43C561B0
==14670== at 0x40EB48DF: enlargePQExpBuffer (pqexpbuffer.c:153)
==14670== by 0x40EB4994: printfPQExpBuffer (pqexpbuffer.c:203)
==14670== by 0x40EB168B: pqReadData (fe-misc.c:449)
==14670== by 0x40EAF334: PQgetResult (fe-exec.c:1337)
==14670== Address 0x43C561B0 is 464 bytes inside a block of size 16384
alloc'd by thread 3
==14670== at 0x4001CA2C: malloc (vg_replace_malloc.c:153)
==14670== by 0x40EABF44: makeEmptyPGconn (fe-connect.c:1881)
==14670== by 0x40EAA319: PQconnectStart (fe-connect.c:273)
==14670== by 0x40EAA2D5: PQconnectdb (fe-connect.c:235)
==14670== Previous state: shared RO, no locks
==14670==
==14670== Thread 2:
==14670== Possible data race reading variable at 0x40D45614
==14670== at 0x4000700D: _dl_lookup_versioned_symbol_internal (in
/lib/ld-2.3.2.so)
==14670== by 0x4000AE8E: fixup (in /lib/ld-2.3.2.so)
==14670== by 0x4000B05F: _dl_runtime_resolve (in /lib/ld-2.3.2.so)
==14670== by 0x40EB168B: pqReadData (fe-misc.c:449)
==14670== Address 0x40D45614 is not stack'd, malloc'd or free'd
==14670== Previous state: shared RW, locked by:0x432F7440
==14670==
==14670== Thread 2:
==14670== Possible data race writing variable at 0x43C561AC
==14670== at 0x40EB497F: printfPQExpBuffer (pqexpbuffer.c:198)
==14670== by 0x40EB168B: pqReadData (fe-misc.c:449)
==14670== by 0x40EAF334: PQgetResult (fe-exec.c:1337)
==14670== by 0x40EAF510: PQexec (fe-exec.c:1441)
==14670== Address 0x43C561AC is 460 bytes inside a block of size 16384
alloc'd by thread 3
==14670== at 0x4001CA2C: malloc (vg_replace_malloc.c:153)
==14670== by 0x40EABF44: makeEmptyPGconn (fe-connect.c:1881)
==14670== by 0x40EAA319: PQconnectStart (fe-connect.c:273)
==14670== by 0x40EAA2D5: PQconnectdb (fe-connect.c:235)
==14670== Previous state: shared RO, no locks
==14670==
==14670== Thread 2:
==14670== Possible data race writing variable at 0x43C56198
==14670== at 0x40EAE3CC: saveErrorResult (fe-exec.c:632)
==14670== by 0x40EAF348: PQgetResult (fe-exec.c:1344)
==14670== by 0x40EAF510: PQexec (fe-exec.c:1441)
==14670== by 0x407870D2: QPSQLDriver::beginTransaction()
(sql/drivers/psql/qsql_psql.cpp:698)
==14670== Address 0x43C56198 is 440 bytes inside a block of size 16384
alloc'd by thread 3
==14670== at 0x4001CA2C: malloc (vg_replace_malloc.c:153)
==14670== by 0x40EABF44: makeEmptyPGconn (fe-connect.c:1881)
==14670== by 0x40EAA319: PQconnectStart (fe-connect.c:273)
==14670== by 0x40EAA2D5: PQconnectdb (fe-connect.c:235)
==14670== Previous state: shared RO, no locks
accessed distinguished 2ndary map! 0x350034
read distinguished 2ndary map! 0x350034
Segmentatie fout (core dumped)

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Bruce Momjian 2003-08-06 00:22:06 ecpg problem in 7.4 beta
Previous Message D'Arcy J.M. Cain 2003-08-05 16:44:15 Re: Seeking PyGreSQL help