[python-sybase] Bad query causes segfaults on Solaris?

Mitch Chapman mitch at predict.com
Tue, 01 Jun 2004 09:06:38 -0600


I'm using SunOS 5.8, Sybase ASE 12.5.1, and Python-Sybase 0.36
with Python 2.3, and am finding that queries which cause Python
exceptions often also result in segmentation faults.  Has anyone
else seen this problem?

Here's a sample traceback/core dump:

-----------------------------------------------------------------------
$ python ~/demo_sybase_segfault.py
Traceback (most recent call last):
   File "/home/mitch/demo_sybase_segfault.py", line 4, in ?
     cursor.execute("SELECT COUNT(*) FROM NonexistentTable")
   File "/usr/local/pkg/python/lib/python2.3/site-packages/Sybase.py", 
line 687, in execute
     self.description = fetcher.start(self.arraysize)
   File "/usr/local/pkg/python/lib/python2.3/site-packages/Sybase.py", 
line 442, in start
     return self._start_results()
   File "/usr/local/pkg/python/lib/python2.3/site-packages/Sybase.py", 
line 546, in _start_results
     status, result = self._cmd.ct_results()
   File "/usr/local/pkg/python/lib/python2.3/site-packages/Sybase.py", 
line 161, in _servermsg_cb
     raise DatabaseError(_fmt_server(msg))
Sybase.DatabaseError: Msg 208, Level 16, State 1, Line 1
NonexistentTable not found. Specify owner.objectname or use sp_help to 
check whether the object exists (sp_help may produce lots of output).

Fatal Python error: unexpected exception during garbage collection
Abort (core dumped)
-----------------------------------------------------------------------

Here's the script which produces the above output:

-----------------------------------------------------------------------
import Sybase
db = Sybase.connect("server", "username", "passwd", "db")
cursor = db.cursor()
cursor.execute("SELECT COUNT(*) FROM NonexistentTable")
db.close()
-----------------------------------------------------------------------

I can collect more info (gdb tracebacks, etc.) if anyone needs it.

Thanks for any help.

--
Mitch