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-04 22:34:20
Message-ID: 200308050034.20405.ftm.van.vugt@foxi.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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=(at)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=(at)0xbf7ffa9c)
at sql/drivers/psql/qsql_psql.cpp:477
#1 0x4060dd44 in QSqlQuery::exec(QString const&) (this=0xbf7ffa8c,
query=(at)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»Ù(at)ü\031\216@Dø?¿\035¬Ø(at)\210",
conn=0x80d0088) at fe-misc.c:85
85 * write 1 char to the connection
(gdb) where
#0 0x40d8c85a in pqGetc (result=0xbf3ff81b "@8»Ù(at)ü\031\216@Dø?¿\035¬Ø(at)\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=(at)0xbf3ffa9c)
at sql/drivers/psql/qsql_psql.cpp:473
#7 0x4060dd44 in QSqlQuery::exec(QString const&) (this=0xbf3ffa8c,
query=(at)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=(at)0xbf3ffa9c)
at sql/drivers/psql/qsql_psql.cpp:473
#7 0x4060dd44 in QSqlQuery::exec(QString const&) (this=0xbf3ffa8c,
query=(at)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)

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2003-08-04 22:41:02 Re: Multi-threaded user app segfaults when using libpq with separate connections
Previous Message Daniel Brozek 2003-08-04 17:28:42 unicode and libpq