[python-sybase] Segentation faults when connecting to SQL Server 2000
Harri Pasanen
harri.pasanen at trema.com
Tue, 10 Sep 2002 10:46:22 +0200
--------------Boundary-00=_ADS7CUKUK0N37J16H3QO
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
On Tuesday 10 September 2002 10:18, hopfgartner wrote:
>
> Here we go:
>
> Traceback (most recent call last):
> File "sqlDumpTbl.py", line 143, in ?
> dump.dump()
> File "sqlDump.py", line 64, in dump
> obj_text =3D self.get_obj_definition(sp[0])
> File "sqlDumpTbl.py", line 31, in get_obj_definition
> self.sql_cursor.execute('SELECT name FROM sysobjects
> WHERE id =3D ' +
> File "/usr/lib/python2.1/site-packages/Sybase.py", line
> 346, in execute
> self._unlock()
> File "/usr/lib/python2.1/site-packages/Sybase.py", line
> 259, in _unlock
> self._owner._lock.release()
> File "/usr/lib/python2.1/threading.py", line 101, in
> release
> assert self.__owner is me, "release() of un-acquire()d
> lock"
> AssertionError: release() of un-acquire()d lock
>
I saw exactly the same thing. If you feel adventurous you can apply the=
=20
quick and dirty patch I have attached to effectively remove the threading=
=20
support which I suspect you are not using anyway.
Note that the patch is in no way cleaned to be final, it just works for m=
e.
Just copy the Sybase.py from /usr/lib/python2.2/site-packages/Sybase.py
to your test script directory, and run:
patch < Sybase.py.test-patch
Then your script has a chance of passing this hurdle...
-Harri
--------------Boundary-00=_ADS7CUKUK0N37J16H3QO
Content-Type: text/x-diff;
charset="iso-8859-1";
name="Sybase.py.test-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="Sybase.py.test-patch"
*** /usr/lib/python2.2/site-packages/Sybase.py Sun Apr 21 08:00:03 2002
--- Sybase.py Wed Sep 4 17:58:00 2002
***************
*** 136,142 ****
raise DatabaseError(_fmt_client(msg))
def _servermsg_cb(ctx, conn, msg):
! if msg.msgnumber not in (5701,):
raise DatabaseError(_fmt_server(msg))
def _row_bind(cmd, count = 1):
--- 136,142 ----
raise DatabaseError(_fmt_client(msg))
def _servermsg_cb(ctx, conn, msg):
! if msg.msgnumber not in (5701,5703):
raise DatabaseError(_fmt_server(msg))
def _row_bind(cmd, count = 1):
***************
*** 242,262 ****
def __del__(self):
if self._state not in (_CUR_IDLE, _CUR_CLOSED):
self._owner._conn.ct_cancel(CS_CANCEL_ALL)
- if self._lock_count:
- # By the time we get called the threading module might
- # have killed the thread the lock was created in ---
- # oops.
- count, owner = self._owner._lock._release_save()
- self._owner._lock._acquire_restore((count, threading.currentThread()))
- while self._lock_count:
- self._unlock()
def _lock(self):
! self._owner._lock.acquire()
self._lock_count = self._lock_count + 1
def _unlock(self):
! self._owner._lock.release()
self._lock_count = self._lock_count - 1
def _raise_error(self, exc, text):
--- 242,254 ----
def __del__(self):
if self._state not in (_CUR_IDLE, _CUR_CLOSED):
self._owner._conn.ct_cancel(CS_CANCEL_ALL)
def _lock(self):
! # self._owner._lock.acquire()
self._lock_count = self._lock_count + 1
def _unlock(self):
! # self._owner._lock.release()
self._lock_count = self._lock_count - 1
def _raise_error(self, exc, text):
--------------Boundary-00=_ADS7CUKUK0N37J16H3QO--