Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 20159475E2B for ; Fri, 15 Nov 2002 23:21:39 -0500 (EST) Received: from snoopy.mohawksoft.com (unknown [24.91.168.211]) by postgresql.org (Postfix) with ESMTP id 65F47475E20 for ; Fri, 15 Nov 2002 23:21:38 -0500 (EST) Received: from mohawksoft.com (snoopy.mohawksoft.com [127.0.0.1]) by snoopy.mohawksoft.com (8.11.6/8.11.6) with ESMTP id gAG4LSg02649; Fri, 15 Nov 2002 23:21:35 -0500 Message-ID: <3DD5C7C8.5090500@mohawksoft.com> Date: Fri, 15 Nov 2002 23:21:28 -0500 From: markw User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Hiroshi Inoue Cc: pgsql-odbc@postgresql.org Subject: Re: Threading crash using ODBC References: <3DD51F26.7050201@mohawksoft.com> <3DD5BEF7.4F734DA4@tpf.co.jp> Content-Type: multipart/alternative; boundary="------------040800010302010703050601" X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/73 X-Sequence-Number: 2250 --------------040800010302010703050601 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Hiroshi Inoue wrote: >markw wrote: > > >>Here's what I have: >> >>I have an application with 1 main thread and a number of worker threads. >>At startup, I allocate a number of ODBC connections. >>I have an internal queue that is protected by a mutex. >>When one of the worker threads wants to use the database, it gets an un >>occupied SQL connection from the queue. >> >>At startup, I can execte a query just fine. When I try to execute a >>query from one of the worker threads, I get a core dump. >> >>I am using UNIX ODBC and the PostgreSQL driver, as shipped with RedHat 7.3. >> >>The stack trace looks like this: >> >>0 0x402fba4c in CC_send_query () from /usr/lib/libodbcpsql.so >>(gdb) where >>#0 0x402fba4c in CC_send_query () from /usr/lib/libodbcpsql.so >>#1 0x40314842 in SC_execute () from /usr/lib/libodbcpsql.so >>#2 0x40304c45 in PG_SQLExecute () from /usr/lib/libodbcpsql.so >>#3 0x40304c6b in SQLExecute () from /usr/lib/libodbcpsql.so >>#4 0x402a13f4 in SQLExecute () from /usr/lib/libodbc.so.1 >>#5 0x40023d6f in MSqlODBC::ExecResult (this=0x806bfd4, >> sql=0x4037f83c "select value, timeout from msession_sessions where >>session = '2b7atuahma6u9igcorr7c6q8ld7ne86o'") at modbcsql.cpp:360 >> >> > >It's the driver provided by unixODBC itself. >Please inquire unixODBC team about it. >Or try the (maybe) thread-safe driver on *nix >recently provided at http://odbc.postgresql.org/. > Actually, I tracked it down. It may be something that you are interested in, I had my stack set to 64K, when I bumped it up to 256K, the problem went away. Both the unixODBC and PostgreSQL drivers are similar, or at least have a similar origin. The stack utilization deserve at least a little scrutiny. --------------040800010302010703050601 Content-Type: text/html; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit

Hiroshi Inoue wrote:
markw wrote:
  
Here's what  I have:

I have an application with 1 main thread and a number of worker threads.
At startup, I allocate a number of ODBC connections.
I have an internal queue that is protected by a mutex.
When one of the worker threads wants to use the database, it gets an un
occupied SQL connection from the queue.

At startup, I can execte a query just fine. When I try to execute a
query from one of the worker threads, I get a core dump.

I am using UNIX ODBC and the PostgreSQL driver, as shipped with RedHat 7.3.

The stack trace looks like this:

0  0x402fba4c in CC_send_query () from /usr/lib/libodbcpsql.so
(gdb) where
#0  0x402fba4c in CC_send_query () from /usr/lib/libodbcpsql.so
#1  0x40314842 in SC_execute () from /usr/lib/libodbcpsql.so
#2  0x40304c45 in PG_SQLExecute () from /usr/lib/libodbcpsql.so
#3  0x40304c6b in SQLExecute () from /usr/lib/libodbcpsql.so
#4  0x402a13f4 in SQLExecute () from /usr/lib/libodbc.so.1
#5  0x40023d6f in MSqlODBC::ExecResult (this=0x806bfd4,
    sql=0x4037f83c "select value, timeout from msession_sessions where
session = '2b7atuahma6u9igcorr7c6q8ld7ne86o'") at modbcsql.cpp:360
    

It's the driver provided by unixODBC itself.
Please inquire unixODBC team about it.
Or try the (maybe) thread-safe driver on *nix
recently provided at http://odbc.postgresql.org/.

Actually, I tracked it down. It may be something that you are interested in, I had my stack set to 64K, when I bumped it up to 256K, the problem went away.

Both the unixODBC and PostgreSQL drivers are similar, or at least have a similar origin. The stack utilization deserve at least a little scrutiny.




--------------040800010302010703050601--