Re: Multi-threaded user app segfaults when using libpq with separate connections - Mailing list pgsql-interfaces

From Frank van Vugt
Subject Re: Multi-threaded user app segfaults when using libpq with separate connections
Date
Msg-id 200308052345.21967.ftm.van.vugt@foxi.nl
Whole thread Raw
In response to Re: Multi-threaded user app segfaults when using libpq with separate connections  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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)



pgsql-interfaces by date:

Previous
From: Christoph Haller
Date:
Subject: Re: unicode and libpq
Next
From: Bruce Momjian
Date:
Subject: ecpg problem in 7.4 beta