|
From: Christophe C. <cc...@fr...> - 2007-07-21 00:54:00
|
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 CS_CANCEL_ATTN, and it don't hangs 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
|