Skip to Content.
Sympa Menu

freetds - [freetds] ct_cancel hangs

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Christophe Combelles <ccomb AT free.fr>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] ct_cancel hangs
  • Date: Sat, 21 Jul 2007 03:04:03 +0200

Hello, I'm posting here my own monolog of a problem I have with
accessing a windows based sybase ASA 7.0 from python/freetds on linux.
The original post was on the python-sybase list, but I'm not sure whether the problem comes from the python module, and there is no activity on that list.

I don't know where the problem is, but the main issue is that cursor.close() hangs after a query folowed by several fetchone.

The problem seems to come from ** ct_cancel(CS_CANCEL_ALL) **

I'm using the latest freetds 0.65dev from 20070717

Christophe

Christophe Combelles a écrit :
Christophe Combelles a écrit :
Hello,

I'm new to this list, and I'm currently trying to access an old windows Sybase ASA 7.0 from python/linux. I could make it work with freedts, but it hangs on some operation:

>>> db=Sybase.connect(...)
>>> c=db.cursor()
>>> c.execute('select * from rue')
>>> c.fetchone()
(...)
>>> c.close()

here it hangs, nothing happens, with 0% CPU.
It only exits if I stop the database server:

Exception Sybase.DatabaseError: <Sybase.DatabaseError instance at 0xb7cf47cc> in <bound method _FetchLazy.__del__ of <Sybase._FetchLazy instance at 0xb7cf4e4c>> ignored

What is the recommended way to investigate this?
Did anyone have the same problem or is it trivial?

thanks,
Christophe

more info:
I'm using python 2.4.4 with sybase-python 0.38 compiled with -D HAVE_FREETDS -U WANT_BULKCOPY, and freetds/libct4 0.64rc2.

it also hangs if I call again c.execute(...) after c.fetchone()

The last thing found in the freetds logfile (debug level 99) is:
-------------------------------------------------------
(...)
token.c:1863:tds_get_data: column 8, type 47, varint size 1
token.c:1920:processing row. column size is 16
token.c:1863:tds_get_data: column 9, type 111, varint size 1
token.c:1920:processing row. column size is 8
token.c:1863:tds_get_data: column 10, type 39, varint size 1
token.c:1920:processing row. column size is 3
token.c:1863:tds_get_data: column 11, type 39, varint size 1
token.c:1920:processing row. column size is 1
token.c:1863:tds_get_data: column 12, type 111, varint size 1
net.c:446:Received header
0000 04 01 00 11 00 00 00 00- |........|

net.c:542:Received packet
0000 fd 30 00 02 00 d1 04 00-00 |.0...... .|

token.c:1920:processing row. column size is 253

-------------------------------------------------------

If I hit Ctrl-C on the python terminal, the freetds logfile tells:

net.c:336:socket read interrupted
(as many times I hit Ctrl-C)


Is there a clue to say if this is an issue in freetds or python-sybase ?

-------------------------------------------------------------------------

I have some news:
In fact, the ct_cancel command hangs in _FetchLazy.__del__ of Sybase.py,
when I call cursor.close() after several fetchone()
But this is a random effect, sometimes it hangs, sometimes not.
It might look like a threading issue.

I don't know what the real problem is, but I've tried to replace CS_CANCEL_ALL
with CS_CANCEL_CURRENT or with CS_CANCEL_ATTN, and it doesn't hang anymore.

The difference between the different types of cancel is explained here:
http://manuals.sybase.com/onlinebooks/group-cnarc/cng1000e/prgguide/@Generic__BookTextView/5783;pt=6133
But I'm not sure what is the correct one in which circumstances.

regards,
Christophe







Archive powered by MHonArc 2.6.24.

Top of Page