You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is: In Azure environment it is observed that sometimes pyodbc library gets hunged while login happens.
This was evaluated using following script.
import pyodbc
import time
import os
GDB Trace
{code}
(gdb) bt
#0 0x00007fc906d170d8 in poll () from /lib64/libc.so.6 #1 0x00007fc8fd58bdd7 in tds_select (tds=0x1bb13c0, tds_sel=, timeout_seconds=0) at net.c:376 #2 0x00007fc8fd58caa0 in tds_goodread (tds=0x1bb13c0, buf=0x7fffd68821e0 "", buflen=8, unfinished=0 '\000') at net.c:449 #3 0x00007fc8fd58cfcd in tds_read_packet (tds=0x1bb13c0) at net.c:530 #4 0x00007fc8fd579148 in tds_get_byte (tds=0x1bb13c0) at read.c:73 #5 0x00007fc8fd5768b8 in tds_process_login_tokens (tds=0x1bb13c0) at token.c:336 #6 0x00007fc8fd5786ad in tds_connect (tds=0x1bb13c0, connection=0x1bb18c0, p_oserr=0x7fffd68826ac) at login.c:467 #7 0x00007fc8fd578f06 in tds_connect_and_login (tds=, connection=) at login.c:508 #8 0x00007fc8fd55ec16 in odbc_connect (dbc=0x1bb0fd0, connection=0x1bb18c0) at odbc.c:393 #9 0x00007fc8fd560653 in _SQLDriverConnect (hdbc=0x1bb0fd0, hwnd=0x0, szConnStrIn=, cbConnStrIn=,
szConnStrOut=0x0, cbConnStrOutMax=0, pcbConnStrOut=0x0, fDriverCompletion=0) at odbc.c:619
#10 0x00007fc900950b4a in SQLDriverConnectW () from /usr/lib64/libodbc.so.2 #11 0x00007fc900b9a6ca in Connect (pConnectString=0x7fc907c64810, hdbc=0x1b503c0, fAnsi=false, timeout=)
at /root/workspace/pyodbc-3.0.7/build/bdist.linux-x86_64/rpm/BUILD/pyodbc-3.0.7/src/connection.cpp:85
#12 0x00007fc900b9a7ed in Connection_New (pConnectString=0x7fc907c64810, fAutoCommit=false, fAnsi=false, fUnicodeResults=,
timeout=0, fReadOnly=false) at /root/workspace/pyodbc-3.0.7/build/bdist.linux-x86_64/rpm/BUILD/pyodbc-3.0.7/src/connection.cpp:166
#13 0x00007fc900b981da in mod_connect (self=, args=, kwargs=)
at /root/workspace/pyodbc-3.0.7/build/bdist.linux-x86_64/rpm/BUILD/pyodbc-3.0.7/src/pyodbcmodule.cpp:371
#14 0x00007fc9079499d4 in PyEval_EvalFrameEx () from /usr/lib64/libpython2.6.so.1.0 #15 0x00007fc90794b647 in PyEval_EvalCodeEx () from /usr/lib64/libpython2.6.so.1.0 #16 0x00007fc90794b722 in PyEval_EvalCode () from /usr/lib64/libpython2.6.so.1.0 #17 0x00007fc907965b9c in ?? () from /usr/lib64/libpython2.6.so.1.0 #18 0x00007fc907965c70 in PyRun_FileExFlags () from /usr/lib64/libpython2.6.so.1.0 #19 0x00007fc90796715c in PyRun_SimpleFileExFlags () from /usr/lib64/libpython2.6.so.1.0 #20 0x00007fc907973892 in Py_Main () from /usr/lib64/libpython2.6.so.1.0 #21 0x00007fc906c56d5d in __libc_start_main () from /lib64/libc.so.6 #22 0x0000000000400649 in _start ()
{code}
The text was updated successfully, but these errors were encountered:
OK, I can't explain the actual pause, which is between FreeTDS and SQL Server, but I can say that I forgot to document the connection functions timeout parameter. It is a number of seconds (an integer), that will set SQL_ATTR_LOGIN_TIMEOUT. This will at least cause an error and you can retry the connection. (I've pushed updated docs now.)
The actual pause will need to be passed on to FreeTDS, though.
The issue is: In Azure environment it is observed that sometimes pyodbc library gets hunged while login happens.
This was evaluated using following script.
import pyodbc
import time
import os
conn_str="DRIVER={FreeTDS};SERVER=10.47.0.4;PORT=1433;UID=sa;PWD=info@123;TDS_VERSION=7.2;timeout=0;Trusted_Connection=no;UseNTLMv2=yes;"
{code}
while(True):
try:
conn = pyodbc.connect(conn_str)
print conn
print os.getpid()
conn.close()
except Exception, e:
print e
{code}
GDB Trace
{code}
(gdb) bt
#0 0x00007fc906d170d8 in poll () from /lib64/libc.so.6
#1 0x00007fc8fd58bdd7 in tds_select (tds=0x1bb13c0, tds_sel=, timeout_seconds=0) at net.c:376
#2 0x00007fc8fd58caa0 in tds_goodread (tds=0x1bb13c0, buf=0x7fffd68821e0 "", buflen=8, unfinished=0 '\000') at net.c:449
#3 0x00007fc8fd58cfcd in tds_read_packet (tds=0x1bb13c0) at net.c:530
#4 0x00007fc8fd579148 in tds_get_byte (tds=0x1bb13c0) at read.c:73
#5 0x00007fc8fd5768b8 in tds_process_login_tokens (tds=0x1bb13c0) at token.c:336
#6 0x00007fc8fd5786ad in tds_connect (tds=0x1bb13c0, connection=0x1bb18c0, p_oserr=0x7fffd68826ac) at login.c:467
#7 0x00007fc8fd578f06 in tds_connect_and_login (tds=, connection=) at login.c:508
#8 0x00007fc8fd55ec16 in odbc_connect (dbc=0x1bb0fd0, connection=0x1bb18c0) at odbc.c:393
#9 0x00007fc8fd560653 in _SQLDriverConnect (hdbc=0x1bb0fd0, hwnd=0x0, szConnStrIn=, cbConnStrIn=,
#10 0x00007fc900950b4a in SQLDriverConnectW () from /usr/lib64/libodbc.so.2
#11 0x00007fc900b9a6ca in Connect (pConnectString=0x7fc907c64810, hdbc=0x1b503c0, fAnsi=false, timeout=)
#12 0x00007fc900b9a7ed in Connection_New (pConnectString=0x7fc907c64810, fAutoCommit=false, fAnsi=false, fUnicodeResults=,
#13 0x00007fc900b981da in mod_connect (self=, args=, kwargs=)
#14 0x00007fc9079499d4 in PyEval_EvalFrameEx () from /usr/lib64/libpython2.6.so.1.0
#15 0x00007fc90794b647 in PyEval_EvalCodeEx () from /usr/lib64/libpython2.6.so.1.0
#16 0x00007fc90794b722 in PyEval_EvalCode () from /usr/lib64/libpython2.6.so.1.0
#17 0x00007fc907965b9c in ?? () from /usr/lib64/libpython2.6.so.1.0
#18 0x00007fc907965c70 in PyRun_FileExFlags () from /usr/lib64/libpython2.6.so.1.0
#19 0x00007fc90796715c in PyRun_SimpleFileExFlags () from /usr/lib64/libpython2.6.so.1.0
#20 0x00007fc907973892 in Py_Main () from /usr/lib64/libpython2.6.so.1.0
#21 0x00007fc906c56d5d in __libc_start_main () from /lib64/libc.so.6
#22 0x0000000000400649 in _start ()
{code}
The text was updated successfully, but these errors were encountered: