Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 33A684759AF for ; Fri, 15 Nov 2002 22:42:24 -0500 (EST) Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by postgresql.org (Postfix) with SMTP id 57CD44758C9 for ; Fri, 15 Nov 2002 22:42:22 -0500 (EST) Received: (qmail 11494 invoked from network); 16 Nov 2002 03:42:25 -0000 Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108) by sd2.tpf-fw-c.co.jp with SMTP; 16 Nov 2002 03:42:25 -0000 Received: from tpf.co.jp (3dgateway1 [126.0.1.60]) by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id MAA29093; Sat, 16 Nov 2002 12:42:24 +0900 (JST) Message-ID: <3DD5BEF7.4F734DA4@tpf.co.jp> Date: Sat, 16 Nov 2002 12:43:51 +0900 From: Hiroshi Inoue X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U) X-Accept-Language: ja MIME-Version: 1.0 To: markw Cc: pgsql-odbc@postgresql.org Subject: Re: Threading crash using ODBC References: <3DD51F26.7050201@mohawksoft.com> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/72 X-Sequence-Number: 2249 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/. regards, Hiroshi Inoue http://w2422.nsk.ne.jp/~inoue/