Skip site navigation (1) Skip section navigation (2)

[ psqlodbc-Bugs-1000735 ] segfault at disconnect (CC_clear_error:414)

From: <noreply(at)pgfoundry(dot)org>
To: noreply(at)pgfoundry(dot)org
Subject: [ psqlodbc-Bugs-1000735 ] segfault at disconnect (CC_clear_error:414)
Date: 2006-12-12 03:53:07
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
Bugs item #1000735, was opened at 2006-09-20 09:47
You can respond by visiting:

Category: None
Group: None
>Status: Closed
Resolution: None
Priority: 3
Submitted By: Nobody (None)
>Assigned to: Hiroshi Inoue (hinoue)
Summary: segfault at disconnect (CC_clear_error:414)

Initial Comment:
psqlodbc (version 08.02.0002) is (in my case) used in the following chain:


the python program segfaulted when disconnecting from the database. here's the backtrace:

(gdb) r
Starting program: /usr/bin/python
[Thread debugging using libthread_db enabled]
[New Thread -1210853696 (LWP 16866)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1210853696 (LWP 16866)]
CC_clear_error (self=0x0) at connection.c:414
414             if (self->__error_message)
(gdb) bt
#0  CC_clear_error (self=0x0) at connection.c:414
#1  0xb7aee7f2 in SC_clear_error (self=0x8333d68) at statement.c:934
#2  0xb7af148e in SC_Destructor (self=0x8333d68) at statement.c:426
#3  0xb7ac88dc in CC_cleanup (self=0x83341a8) at connection.c:519
#4  0xb7ac8fc5 in PGAPI_Disconnect (hdbc=0x83341a8) at connection.c:197
#5  0xb7af8a8c in SQLDisconnect (ConnectionHandle=0x83341a8) at odbcapi.c:299
#6  0xb7bab675 in SQLDisconnect (connection_handle=0x830b690) at SQLDisconnect.c:313
#7  0xb7c044ad in mxODBC_Close (dbc=0xb7cc80c0, report_errors=1) at mx/ODBC/unixODBC/mxODBC.c:6101
#8  0xb7c0458f in mxODBC_close (self=0xb7cc80c0, args=0x0) at mx/ODBC/unixODBC/mxODBC.c:6176
#9  0x080d4fa4 in PyEval_EvalFrame (f=0x829394c) at Python/ceval.c:3542
#10 0x080d53cb in PyEval_EvalFrame (f=0x82514ac) at Python/ceval.c:3640
#11 0x080d6787 in PyEval_EvalCodeEx (co=0xb7d34ee0, globals=0xb7d15824, locals=0xb7d15824, args=0x0,
    argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2736
#12 0x080d67e9 in PyEval_EvalCode (co=0xb7d34ee0, globals=0xb7d15824, locals=0xb7d15824)
    at Python/ceval.c:484
#13 0x080f8f87 in PyRun_FileExFlags (fp=0x8240008, filename=0xbf8a9b8f "", start=257,
    globals=0xb7d15824, locals=0xb7d15824, closeit=1, flags=0xbf8a89f4) at Python/pythonrun.c:1265
#14 0x080f9184 in PyRun_SimpleFileExFlags (fp=0x8240008, filename=0xbf8a9b8f "", closeit=1,
    flags=0xbf8a89f4) at Python/pythonrun.c:860
#15 0x08073606 in Py_Main (argc=1, argv=0xbf8a8ac4) at Modules/main.c:484
#16 0x08072b92 in main (argc=0, argv=0x139) at Modules/python.c:23

after some debugging i found out that the code in connection.c:517 (method CC_cleanup()) does the following:

stmt->hdbc = NULL;	/* prevent any more dbase interactions */

SC_Desctructor() in turn calls SC_clear_error() which calls CC_clear_error (line 934):


the problem here is that self->hdbc is NULL as set in CC_cleanup(). the fix is IMHO changing the statement.c:934 to read:

if (SC_get_conn(self))

attached is the diff.

     Michal Vitecek


>Comment By: Hiroshi Inoue (hinoue)
Date: 2006-12-12 03:53

I believe this problem is fixed already.


Comment By: Hiroshi Inoue (hinoue)
Date: 2006-09-21 02:02

Could you try the 8.2.0100 version at

Hiroshi Inoue


You can respond by visiting:

pgsql-odbc by date

Next:From: noreplyDate: 2006-12-12 03:54:15
Subject: [ psqlodbc-Bugs-1000714 ] Driver gets progressively slower Multi-threading retrieval
Previous:From: Hiroshi InoueDate: 2006-12-12 03:41:44
Subject: Re: Update-able View linked to Access

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group