Skip to Content.
Sympa Menu

freetds - [freetds] "Adaptive Server connection failed" through FreeTDS 8.0 & pymssql

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Doug Morgan <doug AT surveymonkey.com>
  • To: <FreeTDS AT lists.ibiblio.org>
  • Cc: Michael Sela <mikes AT surveymonkey.com>
  • Subject: [freetds] "Adaptive Server connection failed" through FreeTDS 8.0 & pymssql
  • Date: Tue, 19 Jul 2011 10:19:16 -0700

Hello FreeTDS community,

I work for SurveyMonkey and we just started to use pymssql as a
connection to our MS SQL Server 2008 from our python stack. We are using
Ubuntu Server 10.04 LTS, FreeTDS 0.82, Python 2.6, PyMSSQL (v 1.0.2) +
SQLAlchemy and connecting using FreeTDS 8.0 in our freetds.conf file.

We started encountering some issues lately with intermittent connection
problems/failures on our python hosts connecting to the DB servers. The
following is a snippet from our Python logs (not sure how helpful that
will be but including anyway):


File "/xxxxxx/python2.6/site-packages/sqlalchemy/engine/
strategies.py", line 82, in connect
return dialect.connect(*cargs, **cparams)
File "/xxxxxx/python2.6/site-packages/sqlalchemy/engine/default.py",
line 249, in connect
return self.dbapi.connect(*cargs, **cparams)
File "/usr/lib/pymodules/python2.6/pymssql.py", line 607, in connect
raise OperationalError, e[0]
OperationalError: (OperationalError) DB-Lib error message 20004,
severity 9:
Read from the server failed
Net-Lib error during Connection reset by peer Error 104 - Connection
reset by peerDB-Lib error message 20002, severity 9:
Adaptive Server connection failed
None None


This not being very helpful, I turned on FreeTDS debugging (0x4FFF
level) and I am seeing the following in our FreeTDS logs:


net.c:210:Connecting to X.X.X.XX port 1433 (TDS version 8.0)
net.c:266:tds_open_socket: connect(2) returned "Operation now in
progress"
net.c:307:tds_open_socket() succeeded
util.c:162:Changed query state from DEAD to IDLE
login.c:735:quietly sending TDS 7+ login packet
token.c:312:tds_process_login_tokens()
util.c:334:tdserror(0x246d3f0, 0x2a2d1a0, 20004, 104)
dblib.c:7787:dbperror(0x2a3ef50, 20004, 104)
dblib.c:7840:20004: "Read from the server failed"
dblib.c:7861:"Read from the server failed", client returns 2
(INT_CANCEL)
util.c:368:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:389:tdserror: returning TDS_INT_CANCEL(2)
util.c:162:Changed query state from IDLE to DEAD
token.c:316:looking for login token, got 0()
token.c:108:tds_process_default_tokens() marker is 0()
token.c:111:leaving tds_process_default_tokens() connection dead
util.c:334:tdserror(0x246d3f0, 0x2a2d1a0, 20002, 0)
dblib.c:7787:dbperror(0x2a3ef50, 20002, 0)
dblib.c:7840:20002: "Adaptive Server connection failed"
dblib.c:7861:"Adaptive Server connection failed", client returns 2
(INT_CANCEL)
util.c:368:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:389:tdserror: returning TDS_INT_CANCEL(2)
dblib.c:1372:dbclose(0x2a3ef50)
dblib.c:256:dblib_del_connection(0x7fa1883f16c0, 0x2a2d1a0)
mem.c:609:tds_free_all_results()
dblib.c:303:dblib_release_tds_ctx(1)
dblib.c:5731:dbfreebuf(0x2a3ef50)
dblib.c:718:dbloginfree(0x29b8920)
dblib.c:3093:dbcancel(0x31085b0)
query.c:1894:tds_send_cancel: not in_cancel and idle


However, this problem is intermittent, we will get a series of requests
that complete just fine with no problems but then we get a series of
these errors in a row. If anyone has an idea of what is going on / what
we need to do, I'd love some advice.


Thanks,
Doug





  • [freetds] "Adaptive Server connection failed" through FreeTDS 8.0 & pymssql, Doug Morgan, 07/19/2011

Archive powered by MHonArc 2.6.24.

Top of Page