Fwd: 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: pgsql-interfaces(at)postgresql(dot)org
Subject: Fwd: Re: Multi-threaded user app segfaults when using libpq with separate connections
Date: 2003-08-05 07:13:40
Message-ID: 200308050913.40980.ftm.van.vugt@foxi.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

> > I've retried this with a cvs-version
> > This still resulted in more or less the same kind of errors.
>
> Are you sure that each thread is accessing only its own PGconn object?

As sure as I can be, yes.

Run by Qt's main event loop, my code simply creates ten objects of a
particular class. The class declares a static mutex, each object starts a
single thread in whose lifetime a new database connection is setup, used and
destroyed again. So this is something simular to the boss/workers design
pattern adapted to Qt's signal/slot mechanism (which explains why I'm using a
class object per additional thread).

Looking at Qt's code it seems inevitable that a separate PGconn object is
used for each and every connection made. I've taken this problem up with
TrollTech first, they are pretty sure it's not caused by their libs.

> Other than that, not sure what to suggest. I get the impression that
> something is clobbering memory with abandon. Do you have any
> Purify-like tools to look for memory stomp problems?

I know TrollTech is using Purify, I have Valgrind available. You'll find the
output of a run with the option '--trace-pthread=some' attached.

FYI, QSqlDatabase::commit() (sql/qsqldatabase.cpp:775) contains:
if ( !d->driver->hasFeature( QSqlDriver::Transactions ) )
return FALSE;
The parameter is an enum, inside QSqlDriver (the one specific to PostgreSQL),
this resolves into a plain:
bool QPSQLDriver::hasFeature( DriverFeature f ) const
{
switch ( f ) {
case Transactions:
return TRUE;
case QuerySize:
return TRUE;
case BLOB:
return pro >= QPSQLDriver::Version71;
case Unicode:
return d->isUtf8;
default:
return FALSE;
}
}

Best,

Frank.

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

==2028== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==2028== Copyright (C) 2002, and GNU GPL'd, by Julian Seward.
==2028== Using valgrind-1.9.5pre, a program instrumentation system for
x86-linux.
==2028== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
==2028== Estimated CPU clock rate is 501 MHz
==2028== For more details, rerun with: -v
==2028==
--2028-- PTHREAD[1]: pthread_key_create *key 0x41107D40, destr
0x41106480 --2028-- PTHREAD[1]: pthread_getspecific_ptr
--2028-- PTHREAD[1]: pthread_setspecific_ptr ptr 0x4378C024

--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE

--2028-- PTHREAD[1]: pthread_key_validate key 0x0
--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

==2028== Syscall param modify_ldt(ptr)(func=1 or 0x11) contains uninitialised
or unaddressable byte(s)
==2028== at 0x40FFD898: (within /usr/lib/libGL.so.1.0.4363)
==2028== Address 0xBFFFF120 is on thread 1's stack
--2028-- PTHREAD[1]: pthread_key_create *key 0x4102C2A0, destr
0x40FFDC64

--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

--2028-- PTHREAD[1]: pthread_key_validate key 0x1
--2028-- PTHREAD[1]: pthread_getspecific_ptr
--2028-- PTHREAD[1]: pthread_key_create *key 0x40C16DA0, destr 0x0

--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

--2028-- PTHREAD[1]: pthread_key_validate key 0x2
--2028-- PTHREAD[1]: pthread_getspecific_ptr
- *** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

==2028==
==2028== Conditional jump or move depends on uninitialised value(s)
==2028== at 0x40010847: strlen (in /lib/ld-2.3.2.so)
==2028== by 0x4000B312: _dl_signal_cerror (in /lib/ld-2.3.2.so)
==2028== by 0x40006BBE: _dl_lookup_symbol_internal (in /lib/ld-2.3.2.so)
==2028== by 0x40F234F9: do_dlsym (in /lib/libc.so.6)
--2028-- PTHREAD[1]: pthread_key_validate key 0x0
--2028-- PTHREAD[1]: pthread_getspecific_ptr
--2028-- PTHREAD[1]: pthread_key_validate key 0x0
--2028-- PTHREAD[1]: pthread_getspecific_ptr
==2028==
==2028== Syscall param write(buf) contains uninitialised or unaddressable
byte(s)
==2028== at 0x40EE63A8: __GI___libc_write (in /lib/libc.so.6)
==2028== by 0x40C91EBD: _X11TransSocketWrite (in
/usr/X11R6/lib/libX11.so.6.2)
==2028== by 0x40C92AFE: _X11TransWrite (in /usr/X11R6/lib/libX11.so.6.2)
==2028== by 0x40C71663: _XFlushInt (in /usr/X11R6/lib/libX11.so.6.2)
==2028== Address 0x4385DC24 is 116 bytes inside a block of size 2048
alloc'd
==2028== at 0x401633BB: calloc (in /usr/lib/valgrind/valgrind.so)
==2028== by 0x40C62736: XOpenDisplay (in /usr/X11R6/lib/libX11.so.6.2)
==2028== by 0x4042FB87: qt_init_internal(int*, char**, _XDisplay*,
unsigned long, unsigned long) (kernel/qapplication_x11.cpp:1657)
==2028== by 0x40431AC6: qt_init(int*, char**, QApplication::Type)
(kernel/qapplication_x11.cpp:2315)

--2028-- PTHREAD[1]: pthread_key_validate key 0x2
--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

initial print engine constructor reached
==2028== valgrind's libpthread.so: IGNORED call to:
pthread_attr_setinheritsched
--2028-- PTHREAD[1]: pthread_key_create *key 0xBFFFEF68, destr 0x0

--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

--2028-- PTHREAD[1]: pthread_key_create *key 0xBFFFEF68, destr 0x0

--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

--2028-- PTHREAD[1]: pthread_key_create *key 0xBFFFEF68, destr 0x0

--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

--2028-- PTHREAD[1]: pthread_key_create *key 0xBFFFEF68, destr 0x0

--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

--2028-- PTHREAD[1]: pthread_key_create *key 0xBFFFEF68, destr 0x0

--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

--2028-- PTHREAD[1]: pthread_key_create *key 0xBFFFEF68, destr 0x0

--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

--2028-- PTHREAD[1]: pthread_key_create *key 0xBFFFEF68, destr 0x0

--2028-- PTHREAD[1]: pthread_getspecific_ptr
*** DELETED MULTIPLE REPETITIONS OF THE SAME MESSAGE (SET)

==2028== valgrind's libpthread.so: IGNORED call to: pthread_attr_destroy
--2028-- PTHREAD[2]: pthread_key_validate key 0x2
--2028-- PTHREAD[2]: pthread_getspecific_ptr
--2028-- PTHREAD[2]: pthread_setspecific_ptr ptr 0x443F7BA0
print thread run() reached, thread halted
--2028-- PTHREAD[2]: pthread_cond_wait cv 0x4382FC18, mx 0x45113E10:
BLOCK
==2028==
==2028== Syscall param write(buf) contains uninitialised or unaddressable
byte(s)
==2028== at 0x40EE63A8: __GI___libc_write (in /lib/libc.so.6)
==2028== by 0x410FDD9D: _IceTransSocketWrite (in
/usr/X11R6/lib/libICE.so.6.3)
==2028== by 0x410FEB6E: _IceTransWrite (in /usr/X11R6/lib/libICE.so.6.3)
==2028== by 0x410F554A: _IceWrite (in /usr/X11R6/lib/libICE.so.6.3)
==2028== Address 0x438739E8 is 12 bytes inside a block of size 1024
alloc'd ==2028== at 0x401633BB: calloc (in /usr/lib/valgrind/valgrind.so)
==2028== by 0x410F24A6: IceOpenConnection (in
/usr/X11R6/lib/libICE.so.6.3) ==2028== by 0x410E73A0: SmcOpenConnection
(in /usr/X11R6/lib/libSM.so.6.0) ==2028== by 0x4043AF43:
QSessionManager::QSessionManager(QApplication*, QString&, QString&)
(kernel/qapplication_x11.cpp:6183)
--2028-- PTHREAD[2]: pthread_cond_signal cv 0x4382FC18: RESUME with mx
0x45113E10
new print engine created
==2028== valgrind's libpthread.so: IGNORED call to:
pthread_attr_setinheritsched
==2028== valgrind's libpthread.so: IGNORED call to: pthread_attr_destroy
new print engine created
==2028== valgrind's libpthread.so: IGNORED call to:
pthread_attr_setinheritsched
==2028== valgrind's libpthread.so: IGNORED call to: pthread_attr_destroy
print thread continued
trying to lock my_active in order to add/open a database
my_active has been locked in order to add/open database connection
(08:04:27.670)
==2028==
==2028== Thread 2:
==2028== Conditional jump or move depends on uninitialised value(s)
==2028== at 0x40010606: strchr (in /lib/ld-2.3.2.so)
--2028-- PTHREAD[3]: pthread_mutex_lock mx 0x40D15688: BLOCK
--2028-- PTHREAD[4]: pthread_mutex_lock mx 0x40D15688: BLOCK
new print engine created
new print engine created
new print engine created
new print engine created
new print engine created
new print engine created
new print engine created
--2028-- PTHREAD[3]: pthread_mutex_lock mx 0x40D15688: RESUME
--2028-- PTHREAD[4]: pthread_mutex_lock mx 0x40D15688: RESUME
--2028-- PTHREAD[3]: pthread_key_validate key 0x2
--2028-- PTHREAD[3]: pthread_getspecific_ptr
--2028-- PTHREAD[3]: pthread_setspecific_ptr ptr 0x443C6A78
print thread run() reached, thread halted
--2028-- PTHREAD[3]: pthread_cond_wait cv 0x4382FC18, mx 0x45433E10:
BLOCK
--2028-- PTHREAD[4]: pthread_key_validate key 0x2
--2028-- PTHREAD[4]: pthread_getspecific_ptr
--2028-- PTHREAD[4]: pthread_setspecific_ptr ptr 0x443C36F4
print thread run() reached, thread halted
--2028-- PTHREAD[4]: pthread_cond_wait cv 0x4382FC18, mx 0x45665E10:
BLOCK
--2028-- PTHREAD[5]: pthread_key_validate key 0x2
--2028-- PTHREAD[5]: pthread_getspecific_ptr
--2028-- PTHREAD[5]: pthread_setspecific_ptr ptr 0x443C6B70
print thread run() reached, thread halted
--2028-- PTHREAD[5]: pthread_cond_wait cv 0x4382FC18, mx 0x458FBE10:
BLOCK
--2028-- PTHREAD[6]: pthread_key_validate key 0x2
--2028-- PTHREAD[6]: pthread_getspecific_ptr
--2028-- PTHREAD[6]: pthread_setspecific_ptr ptr 0x443C37EC
print thread run() reached, thread halted
--2028-- PTHREAD[6]: pthread_cond_wait cv 0x4382FC18, mx 0x45B1BE10:
BLOCK
--2028-- PTHREAD[7]: pthread_key_validate key 0x2
--2028-- PTHREAD[7]: pthread_getspecific_ptr
--2028-- PTHREAD[7]: pthread_setspecific_ptr ptr 0x443C6C68
print thread run() reached, thread halted
--2028-- PTHREAD[7]: pthread_cond_wait cv 0x4382FC18, mx 0x45D4DE10:
BLOCK
--2028-- PTHREAD[8]: pthread_key_validate key 0x2
--2028-- PTHREAD[8]: pthread_getspecific_ptr
--2028-- PTHREAD[8]: pthread_setspecific_ptr ptr 0x443C38E4
print thread run() reached, thread halted
--2028-- PTHREAD[8]: pthread_cond_wait cv 0x4382FC18, mx 0x45F7FE10:
BLOCK
--2028-- PTHREAD[9]: pthread_key_validate key 0x2
--2028-- PTHREAD[9]: pthread_getspecific_ptr
--2028-- PTHREAD[9]: pthread_setspecific_ptr ptr 0x443C6D60
print thread run() reached, thread halted
--2028-- PTHREAD[9]: pthread_cond_wait cv 0x4382FC18, mx 0x4619FE10:
BLOCK
--2028-- PTHREAD[10]: pthread_key_validate key 0x2
--2028-- PTHREAD[10]: pthread_getspecific_ptr
--2028-- PTHREAD[10]: pthread_setspecific_ptr ptr 0x443C39DC
print thread run() reached, thread halted
--2028-- PTHREAD[10]: pthread_cond_wait cv 0x4382FC18, mx 0x464BFE10:
BLOCK
--2028-- PTHREAD[3]: pthread_cond_signal cv 0x4382FC18: RESUME with mx
0x45433E10
new print engine created
--2028-- PTHREAD[4]: pthread_cond_signal cv 0x4382FC18: RESUME with mx
0x45665E10
new print engine created
--2028-- PTHREAD[5]: pthread_cond_signal cv 0x4382FC18: RESUME with mx
0x458FBE10
new print engine created
--2028-- PTHREAD[6]: pthread_cond_signal cv 0x4382FC18: RESUME with mx
0x45B1BE10
new print engine created
--2028-- PTHREAD[7]: pthread_cond_signal cv 0x4382FC18: RESUME with mx
0x45D4DE10
new print engine created
--2028-- PTHREAD[2]: pthread_key_validate key 0x2
--2028-- PTHREAD[2]: pthread_getspecific_ptr
--2028-- PTHREAD[2]: pthread_key_validate key 0x2
--2028-- PTHREAD[2]: pthread_getspecific_ptr
print thread continued
trying to lock my_active in order to add/open a database
--2028-- PTHREAD[3]: pthread_mutex_lock mx 0x4382FB94: BLOCK
print thread continued
trying to lock my_active in order to add/open a database
--2028-- PTHREAD[4]: pthread_mutex_lock mx 0x4382FB94: BLOCK
print thread continued
trying to lock my_active in order to add/open a database
--2028-- PTHREAD[5]: pthread_mutex_lock mx 0x4382FB94: BLOCK
print thread continued
trying to lock my_active in order to add/open a database
--2028-- PTHREAD[6]: pthread_mutex_lock mx 0x4382FB94: BLOCK
print thread continued
trying to lock my_active in order to add/open a database
--2028-- PTHREAD[7]: pthread_mutex_lock mx 0x4382FB94: BLOCK
--2028-- PTHREAD[11]: pthread_key_validate key 0x2
--2028-- PTHREAD[11]: pthread_getspecific_ptr
--2028-- PTHREAD[11]: pthread_setspecific_ptr ptr 0x443CDBC8
print thread run() reached, thread halted
--2028-- PTHREAD[11]: pthread_cond_wait cv 0x4382FC18, mx 0x4672CE10:
BLOCK
--2028-- PTHREAD[12]: pthread_key_validate key 0x2
--2028-- PTHREAD[12]: pthread_getspecific_ptr
--2028-- PTHREAD[12]: pthread_setspecific_ptr ptr 0x443CFEE4
print thread run() reached, thread halted
--2028-- PTHREAD[12]: pthread_cond_wait cv 0x4382FC18, mx 0x4694CE10:
BLOCK
--2028-- PTHREAD[13]: pthread_key_validate key 0x2
--2028-- PTHREAD[13]: pthread_getspecific_ptr
--2028-- PTHREAD[13]: pthread_setspecific_ptr ptr 0x443CDCC0
print thread run() reached, thread halted
--2028-- PTHREAD[13]: pthread_cond_wait cv 0x4382FC18, mx 0x46B7EE10:
BLOCK
--2028-- PTHREAD[14]: pthread_key_validate key 0x2
--2028-- PTHREAD[14]: pthread_getspecific_ptr
--2028-- PTHREAD[14]: pthread_setspecific_ptr ptr 0x443CFFDC
print thread run() reached, thread halted
--2028-- PTHREAD[14]: pthread_cond_wait cv 0x4382FC18, mx 0x46DB0E10:
BLOCK
--2028-- PTHREAD[15]: pthread_key_validate key 0x2
--2028-- PTHREAD[15]: pthread_getspecific_ptr
--2028-- PTHREAD[15]: pthread_setspecific_ptr ptr 0x443CDDB8
print thread run() reached, thread halted
--2028-- PTHREAD[15]: pthread_cond_wait cv 0x4382FC18, mx 0x46FE2E10:
BLOCK
--2028-- PTHREAD[16]: pthread_key_validate key 0x2
--2028-- PTHREAD[16]: pthread_getspecific_ptr
--2028-- PTHREAD[16]: pthread_setspecific_ptr ptr 0x443D00D4
print thread run() reached, thread halted
--2028-- PTHREAD[16]: pthread_cond_wait cv 0x4382FC18, mx 0x47214E10:
BLOCK
--2028-- PTHREAD[2]: pthread_key_validate key 0x2
--2028-- PTHREAD[2]: pthread_getspecific_ptr
--2028-- PTHREAD[2]: pthread_key_validate key 0x2
--2028-- PTHREAD[2]: pthread_getspecific_ptr
trying to unlock my_active since we now have added/opened a database
--2028-- PTHREAD[3]: pthread_mutex_lock mx 0x4382FB94: RESUME
my_active has been locked after opening database connection (08:08:26.717)
--2028-- PTHREAD[2]: pthread_mutex_lock mx 0x441C8ADC: BLOCK
my_active has been locked in order to add/open database connection
(08:08:26.810)
--2028-- PTHREAD[3]: pthread_mutex_lock mx 0x441C8ADC: BLOCK
--2028-- PTHREAD[2]: pthread_mutex_lock mx 0x441C8ADC: RESUME
--2028-- PTHREAD[1]: pthread_mutex_lock mx 0x441C8ADC: BLOCK
--2028-- PTHREAD[1]: pthread_mutex_lock mx 0x441C8ADC: RESUME
--2028-- PTHREAD[2]: pthread_key_validate key 0x2
--2028-- PTHREAD[2]: pthread_getspecific_ptr
--2028-- PTHREAD[3]: pthread_mutex_lock mx 0x441C8ADC: RESUME
--2028-- PTHREAD[1]: pthread_mutex_lock mx 0x441C8ADC: BLOCK
--2028-- PTHREAD[1]: pthread_mutex_lock mx 0x441C8ADC: RESUME
--2028-- PTHREAD[3]: pthread_mutex_lock mx 0x441C8ADC: BLOCK
--2028-- PTHREAD[3]: pthread_mutex_lock mx 0x441C8ADC: RESUME
--2028-- PTHREAD[1]: pthread_mutex_lock mx 0x441C8ADC: BLOCK
--2028-- PTHREAD[2]: pthread_key_validate key 0x2
--2028-- PTHREAD[2]: pthread_getspecific_ptr
--2028-- PTHREAD[1]: pthread_mutex_lock mx 0x441C8ADC: RESUME
--2028-- PTHREAD[3]: pthread_key_validate key 0x2
--2028-- PTHREAD[3]: pthread_getspecific_ptr
--2028-- PTHREAD[3]: pthread_key_validate key 0x2
--2028-- PTHREAD[3]: pthread_getspecific_ptr
==2028==
==2028== Thread 2:
==2028== Invalid read of size 4
==2028== at 0x4080597A: QSqlDatabase::commit() (sql/qsqldatabase.cpp:775)
==2028== by 0x8050BAC: PrintEngine::run() (printengine.cpp:118)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)
==2028== by 0x40D0E5C8: thread_wrapper (in
/usr/lib/valgrind/libpthread.so) ==2028== Address 0x443F8E8C is 40 bytes
inside a block of size 44 free'd ==2028== at 0x40163266: __builtin_delete
(in /usr/lib/valgrind/valgrind.so) ==2028== by 0x40163284: operator
delete(void*) (in
/usr/lib/valgrind/valgrind.so)
==2028== by 0x408056A1: QSqlDatabase::~QSqlDatabase()
(sql/qsqldatabase.cpp:674)
==2028== by 0x40806D8C: QDict<QSqlDatabase>::deleteItem(void*)
(../include/qdict.h:97)
==2028==
==2028== Thread 2:
==2028== Invalid read of size 4
==2028== at 0x4080597D: QSqlDatabase::commit() (sql/qsqldatabase.cpp:775)
==2028== by 0x8050BAC: PrintEngine::run() (printengine.cpp:118)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)
==2028== by 0x40D0E5C8: thread_wrapper (in
/usr/lib/valgrind/libpthread.so) ==2028== Address 0x443F8EFC is 0 bytes
inside a block of size 36 free'd ==2028== at 0x40163266: __builtin_delete
(in /usr/lib/valgrind/valgrind.so) ==2028== by 0x40163284: operator
delete(void*) (in
/usr/lib/valgrind/valgrind.so)
==2028== by 0x40805655: QSqlDatabase::~QSqlDatabase()
(sql/qsqldatabase.cpp:660)
==2028== by 0x40806D8C: QDict<QSqlDatabase>::deleteItem(void*)
(../include/qdict.h:97)
==2028==
==2028== Thread 2:
==2028== Invalid read of size 4
==2028== at 0x4080597F: QSqlDatabase::commit() (sql/qsqldatabase.cpp:775)
==2028== by 0x8050BAC: PrintEngine::run() (printengine.cpp:118)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)
==2028== by 0x40D0E5C8: thread_wrapper (in
/usr/lib/valgrind/libpthread.so) ==2028== Address 0x443F8F50 is 0 bytes
inside a block of size 72 free'd ==2028== at 0x40163266: __builtin_delete
(in /usr/lib/valgrind/valgrind.so) ==2028== by 0x40163284: operator
delete(void*) (in
/usr/lib/valgrind/valgrind.so)
==2028== by 0x4082D983: QPSQLDriver::~QPSQLDriver()
(sql/drivers/psql/qsql_psql.cpp:600)
==2028== by 0x408055FC: QSqlDatabase::~QSqlDatabase()
(sql/qsqldatabase.cpp:656)
==2028==
==2028== Thread 2:
==2028== Invalid read of size 4
==2028== at 0x40805989: QSqlDatabase::commit() (sql/qsqldatabase.cpp:775)
==2028== by 0x8050BAC: PrintEngine::run() (printengine.cpp:118)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)
==2028== by 0x40D0E5C8: thread_wrapper (in
/usr/lib/valgrind/libpthread.so) ==2028== Address 0x443F8E8C is 40 bytes
inside a block of size 44 free'd ==2028== at 0x40163266: __builtin_delete
(in /usr/lib/valgrind/valgrind.so) ==2028== by 0x40163284: operator
delete(void*) (in
/usr/lib/valgrind/valgrind.so)
==2028== by 0x408056A1: QSqlDatabase::~QSqlDatabase()
(sql/qsqldatabase.cpp:674)
==2028== by 0x40806D8C: QDict<QSqlDatabase>::deleteItem(void*)
(../include/qdict.h:97)
==2028==
==2028== Thread 2:
==2028== Invalid read of size 4
==2028== at 0x4080598C: QSqlDatabase::commit() (sql/qsqldatabase.cpp:775)
==2028== by 0x8050BAC: PrintEngine::run() (printengine.cpp:118)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)
==2028== by 0x40D0E5C8: thread_wrapper (in
/usr/lib/valgrind/libpthread.so) ==2028== Address 0x443F8EFC is 0 bytes
inside a block of size 36 free'd ==2028== at 0x40163266: __builtin_delete
(in /usr/lib/valgrind/valgrind.so) ==2028== by 0x40163284: operator
delete(void*) (in
/usr/lib/valgrind/valgrind.so)
==2028== by 0x40805655: QSqlDatabase::~QSqlDatabase()
(sql/qsqldatabase.cpp:660)
==2028== by 0x40806D8C: QDict<QSqlDatabase>::deleteItem(void*)
(../include/qdict.h:97)
disInstr: unhandled opcode 0x6E then 0xCD

valgrind: the `impossible' happened:
unhandled x86 opcode
Basic block ctr is approximately 22650000

sched status:

Thread 1: status = Runnable, associated_mx = 0x0, associated_cv = 0x0
==2028== at 0x40007BB0: do_lookup (in /lib/ld-2.3.2.so)
==2028== by 0x400069E2: _dl_lookup_symbol_internal (in /lib/ld-2.3.2.so)
==2028== by 0x4000AE30: fixup (in /lib/ld-2.3.2.so)
==2028== by 0x4000B05F: _dl_runtime_resolve (in /lib/ld-2.3.2.so)

Thread 2: status = Runnable, associated_mx = 0x0, associated_cv = 0x0
==2028== at 0x40ADAF78: ???
==2028== by 0x8050BAC: PrintEngine::run() (printengine.cpp:118)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)
==2028== by 0x40D0E5C8: thread_wrapper (in
/usr/lib/valgrind/libpthread.so)

Thread 3: status = Runnable, associated_mx = 0x0, associated_cv = 0x0
==2028== at 0x4043C542: QGArray::at(unsigned) const
(../include/qgarray.h:120)
==2028== by 0x4090262B: QRegExpEngine::heuristicallyChooseHeuristic()
(tools/qregexp.cpp:1495)
==2028== by 0x40906573: QRegExpEngine::Box::setupHeuristics()
(tools/qregexp.cpp:2545)
==2028== by 0x40907832: QRegExpEngine::parse(QChar const*, int)
(tools/qregexp.cpp:2940)

Thread 4: status = WaitMX, associated_mx = 0x4382FB94, associated_cv = 0x0
==2028== at 0x40D0EB94: __pthread_mutex_lock (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D3D29: QRealMutexPrivate::lock()
(tools/qmutex_unix.cpp:142)
==2028== by 0x408D4963: QMutex::lock() (tools/qmutex_unix.cpp:464)
==2028== by 0x804FD9E: PrintEngine::run() (printengine.cpp:56)

Thread 5: status = WaitMX, associated_mx = 0x4382FB94, associated_cv = 0x0
==2028== at 0x40D0EB94: __pthread_mutex_lock (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D3D29: QRealMutexPrivate::lock()
(tools/qmutex_unix.cpp:142)
==2028== by 0x408D4963: QMutex::lock() (tools/qmutex_unix.cpp:464)
==2028== by 0x804FD9E: PrintEngine::run() (printengine.cpp:56)

Thread 6: status = WaitMX, associated_mx = 0x4382FB94, associated_cv = 0x0
==2028== at 0x40D0EB94: __pthread_mutex_lock (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D3D29: QRealMutexPrivate::lock()
(tools/qmutex_unix.cpp:142)
==2028== by 0x408D4963: QMutex::lock() (tools/qmutex_unix.cpp:464)
==2028== by 0x804FD9E: PrintEngine::run() (printengine.cpp:56)

Thread 7: status = WaitMX, associated_mx = 0x4382FB94, associated_cv = 0x0
==2028== at 0x40D0EB94: __pthread_mutex_lock (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D3D29: QRealMutexPrivate::lock()
(tools/qmutex_unix.cpp:142)
==2028== by 0x408D4963: QMutex::lock() (tools/qmutex_unix.cpp:464)
==2028== by 0x804FD9E: PrintEngine::run() (printengine.cpp:56)

Thread 8: status = WaitCV, associated_mx = 0x45F7FE10, associated_cv =
0x4382FC18
==2028== at 0x40D0EE6A: pthread_cond_wait (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D5C79: QWaitCondition::wait(unsigned long)
(tools/qwaitcondition_unix.cpp:243)
==2028== by 0x804FD6D: PrintEngine::run() (printengine.cpp:51)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)

Thread 9: status = WaitCV, associated_mx = 0x4619FE10, associated_cv =
0x4382FC18
==2028== at 0x40D0EE6A: pthread_cond_wait (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D5C79: QWaitCondition::wait(unsigned long)
(tools/qwaitcondition_unix.cpp:243)
==2028== by 0x804FD6D: PrintEngine::run() (printengine.cpp:51)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)

Thread 10: status = WaitCV, associated_mx = 0x464BFE10, associated_cv =
0x4382FC18
==2028== at 0x40D0EE6A: pthread_cond_wait (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D5C79: QWaitCondition::wait(unsigned long)
(tools/qwaitcondition_unix.cpp:243)
==2028== by 0x804FD6D: PrintEngine::run() (printengine.cpp:51)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)

Thread 11: status = WaitCV, associated_mx = 0x4672CE10, associated_cv =
0x4382FC18
==2028== at 0x40D0EE6A: pthread_cond_wait (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D5C79: QWaitCondition::wait(unsigned long)
(tools/qwaitcondition_unix.cpp:243)
==2028== by 0x804FD6D: PrintEngine::run() (printengine.cpp:51)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)

Thread 12: status = WaitCV, associated_mx = 0x4694CE10, associated_cv =
0x4382FC18
==2028== at 0x40D0EE6A: pthread_cond_wait (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D5C79: QWaitCondition::wait(unsigned long)
(tools/qwaitcondition_unix.cpp:243)
==2028== by 0x804FD6D: PrintEngine::run() (printengine.cpp:51)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)

Thread 13: status = WaitCV, associated_mx = 0x46B7EE10, associated_cv =
0x4382FC18
==2028== at 0x40D0EE6A: pthread_cond_wait (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D5C79: QWaitCondition::wait(unsigned long)
(tools/qwaitcondition_unix.cpp:243)
==2028== by 0x804FD6D: PrintEngine::run() (printengine.cpp:51)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)

Thread 14: status = WaitCV, associated_mx = 0x46DB0E10, associated_cv =
0x4382FC18
==2028== at 0x40D0EE6A: pthread_cond_wait (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D5C79: QWaitCondition::wait(unsigned long)
(tools/qwaitcondition_unix.cpp:243)
==2028== by 0x804FD6D: PrintEngine::run() (printengine.cpp:51)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)

Thread 15: status = WaitCV, associated_mx = 0x46FE2E10, associated_cv =
0x4382FC18
==2028== at 0x40D0EE6A: pthread_cond_wait (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D5C79: QWaitCondition::wait(unsigned long)
(tools/qwaitcondition_unix.cpp:243)
==2028== by 0x804FD6D: PrintEngine::run() (printengine.cpp:51)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)

Thread 16: status = WaitCV, associated_mx = 0x47214E10, associated_cv =
0x4382FC18
==2028== at 0x40D0EE6A: pthread_cond_wait (in
/usr/lib/valgrind/libpthread.so)
==2028== by 0x408D5C79: QWaitCondition::wait(unsigned long)
(tools/qwaitcondition_unix.cpp:243)
==2028== by 0x804FD6D: PrintEngine::run() (printengine.cpp:51)
==2028== by 0x404A6BF5: QThreadInstance::start(void*)
(kernel/qthread_unix.cpp:120)

Please report this bug to: jseward(at)acm(dot)org

-------------------------------------------------------

--
MvG,

Frank.

Browse pgsql-interfaces by date

  From Date Subject
Next Message Alastair G. Hogge 2003-08-05 08:16:06 Seeking PyGreSQL help
Previous Message Tom Lane 2003-08-04 22:41:02 Re: Multi-threaded user app segfaults when using libpq with separate connections