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 200308050034.20405.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>)
Responses Re: Multi-threaded user app segfaults when using libpq with separate connections
List pgsql-interfaces
Hi Tom,

> It seems highly unlikely that the above is a good idea.  <cut>
> The behavior complained of in the comment
> is gone anyway in PG 7.3.

I've conveyed the message, thanks.

> You may care to try your test with CVS tip and see if it works better.

I've retried this with a cvs-version of this afternoon (local time). The build
stranded in plpgsql (I seem to need a more recent bison), but at that point
libpq was already finished. This still resulted in more or less the same kind
of errors. I then retried with a cvs-version of 21:30 (utc), configured with
enable-thread-safety and compiled with debug info / without optimization,
along with a fresh compilation of Qt.

Results : same diff (see errors below).


What more can I do to help out / find out what the problem is ?




Best,








Frank van Vugt

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

#0  0x4063ab77 in QPSQLResult::reset(QString const&) (this=0x80c10f0,
query=@0xbf7ffa9c)   at sql/drivers/psql/qsql_psql.cpp:477
477         int status =  PQresultStatus( d->result );
(gdb) where
#0  0x4063ab77 in QPSQLResult::reset(QString const&) (this=0x80c10f0,
query=@0xbf7ffa9c)   at sql/drivers/psql/qsql_psql.cpp:477
#1  0x4060dd44 in QSqlQuery::exec(QString const&) (this=0xbf7ffa8c,
query=@0xbf7ffa9c) at sql/qsqlquery.cpp:358
#2  0x08050823 in PrintEngine::run() (this=0x809e2b8) at printengine.cpp:97
#3  0x402b4bf6 in QThreadInstance::start(void*) (_arg=0x809e31c) at
kernel/qthread_unix.cpp:120
#4  0x40b1dc60 in pthread_start_thread () from /lib/libpthread.so.0
(gdb)


#0  0x40d8c85a in pqGetc (result=0xbf3ff81b "@8»Ù@ü\031\216@Dø?¿\035¬Ø@\210",
conn=0x80d0088) at fe-misc.c:85
85       * write 1 char to the connection
(gdb) where
#0  0x40d8c85a in pqGetc (result=0xbf3ff81b "@8»Ù@ü\031\216@Dø?¿\035¬Ø@\210",
conn=0x80d0088) at fe-misc.c:85
#1  0x40d90afe in pqParseInput2 (conn=0x80d0088) at fe-protocol2.c:384
#2  0x40d8ac1d in parseInput (conn=0x80d0088) at fe-exec.c:918
#3  0x40d8ac8f in PQgetResult (conn=0x80d0088) at fe-exec.c:955
#4  0x40d8b0ac in PQexecFinish (conn=0x80d0088) at fe-exec.c:1159
#5  0x40d8aec6 in PQexec (conn=0x80d0088, query=0x80d4270 "set transaction
isolation level SERIALIZABLE") at fe-exec.c:1047
#6  0x4063aab7 in QPSQLResult::reset(QString const&) (this=0x80d3d20,
query=@0xbf3ffa9c)   at sql/drivers/psql/qsql_psql.cpp:473
#7  0x4060dd44 in QSqlQuery::exec(QString const&) (this=0xbf3ffa8c,
query=@0xbf3ffa9c) at sql/qsqlquery.cpp:358
#8  0x08050411 in PrintEngine::run() (this=0x80a1860) at printengine.cpp:85
#9  0x402b4bf6 in QThreadInstance::start(void*) (_arg=0x80bd4c4) at
kernel/qthread_unix.cpp:120
#10 0x40b1dc60 in pthread_start_thread () from /lib/libpthread.so.0
Current language:  auto; currently c
(gdb)


#0  0x4061391d in QSqlDatabase::transaction() (this=0x80cc078) at
sql/qsqldatabase.cpp:760
760         if ( !d->driver->hasFeature( QSqlDriver::Transactions ) )
(gdb) where
#0  0x4061391d in QSqlDatabase::transaction() (this=0x80cc078) at
sql/qsqldatabase.cpp:760
#1  0x080503db in PrintEngine::run() (this=0x80a70b8) at printengine.cpp:83
#2  0x402b4bf6 in QThreadInstance::start(void*) (_arg=0x80c0c3c) at
kernel/qthread_unix.cpp:120
#3  0x40b1dc60 in pthread_start_thread () from /lib/libpthread.so.0
(gdb)


#0  0x40d89ea0 in PQclear (res=0x417974dd) at fe-exec.c:349
349
(gdb) where
#0  0x40d89ea0 in PQclear (res=0x417974dd) at fe-exec.c:349
#1  0x40d89f12 in pqClearAsyncResult (conn=0x80cba10) at fe-exec.c:369
#2  0x40d89f7a in pqSaveErrorResult (conn=0x80cba10) at fe-exec.c:397
#3  0x40d8ad11 in PQgetResult (conn=0x80cba10) at fe-exec.c:984
#4  0x40d8b0ac in PQexecFinish (conn=0x80cba10) at fe-exec.c:1159
#5  0x40d8aec6 in PQexec (conn=0x80cba10, query=0x80d8178 "set transaction
isolation level SERIALIZABLE") at fe-exec.c:1047
#6  0x4063aab7 in QPSQLResult::reset(QString const&) (this=0x80d7f98,
query=@0xbf3ffa9c)   at sql/drivers/psql/qsql_psql.cpp:473
#7  0x4060dd44 in QSqlQuery::exec(QString const&) (this=0xbf3ffa8c,
query=@0xbf3ffa9c) at sql/qsqlquery.cpp:358
#8  0x08050411 in PrintEngine::run() (this=0x80be3b0) at printengine.cpp:85
#9  0x402b4bf6 in QThreadInstance::start(void*) (_arg=0x80c0c44) at
kernel/qthread_unix.cpp:120
#10 0x40b1dc60 in pthread_start_thread () from /lib/libpthread.so.0
Current language:  auto; currently c
(gdb)



pgsql-interfaces by date:

Previous
From: Daniel Brozek
Date:
Subject: unicode and libpq
Next
From: Tom Lane
Date:
Subject: Re: Multi-threaded user app segfaults when using libpq with separate connections