TinyTDS Looping on "Adaptive Server connection timed out" (Azure SQL)
August Jaenicke <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CAKbFGG=F0F7Tpq6u6gTLk-k2H2ZVVQ3j40mpBMSJFR+d+1Np4g@mail.gmail.com> |
I am using TinyTDS in DLIB mode on Ubuntu 12.04 with FreeTDS 0.91. Everything works flawlessly - until the Azure SQL drops the connection. Unfortunately, TinyTDS/FreeTDS keeps trying to reuse that same connection over and over. The db service sends back => 20003 "Adaptive Server connection timed out". Then FreeTDS/Tiny TDS go in a loop with the server, responding with INT_CONTINUE. The server responds again with the 20003 error. They go back and forth until something else reaps the process. I have no timeouts set in the freetds.conf file. It is empty except to activate the logging. I am running on Ubuntu 12.04, Rails 3.2. I posted on TinyTDS's git issues as well: https://github.com/rails-sqlserver/tiny_tds/issues/138 Here is the FreeTDS log for a failed attempt: 1:17:27.063192 48918 (dblib.c:4880):dbdead(0x2e5ecb0) [alive] 21:17:27.072366 48918 (dblib.c:1312):dbcmd(0x2e5ecb0, EXEC sp_executesql N'SELECT TOP (1) [users].* FROM [users] WHERE [users].[id] = @0<https://github.com/0>', N'@0 <https://github.com/0> int', @0 <https://github.com/0> = 1) 21:17:27.072434 48918 (dblib.c:1319):dbcmd() bufsz = 148 21:17:27.072464 48918 (dblib.c:5882):dbfreebuf(0x2e5ecb0) 21:17:27.072512 48918 (dblib.c:6862):dbsqlsend(0x2e5ecb0) 21:17:27.072540 48918 (mem.c:615):tds_free_all_results() 21:17:27.072567 48918 (util.c:156):Changed query state from IDLE to QUERYING 21:17:27.072597 48918 (write.c:140):tds_put_string converting 102 bytes of "EXEC sp_executesql N'SELECT TOP (1) [users].* FROM [users] WHERE [users].[id] = @0 <https://github.com/0>', N'@0 <https://github.com/0> int', @0 <https://github.com/0> = 1" 21:17:27.072882 48918 (write.c:168):tds_put_string wrote 204 bytes 21:17:27.072911 48918 (util.c:156):Changed query state from QUERYING to PENDING 21:17:27.072938 48918 (net.c:741):Sending packet 21:17:27.073066 48918 (net.c:1240):in tds_push_func 21:17:27.073208 48918 (dblib.c:5780):dbgetuserdata(0x2e5ecb0) 21:17:27.073251 48918 (dblib.c:5780):dbgetuserdata(0x2e5ecb0) 21:17:27.073278 48918 (dblib.c:5780):dbgetuserdata(0x2e5ecb0) 21:17:27.073304 48918 (dblib.c:5780):dbgetuserdata(0x2e5ecb0) 21:17:27.073331 48918 (dblib.c:4639):dbsqlok(0x2e5ecb0) 21:17:27.073357 48918 (dblib.c:4669):dbsqlok() not done, calling tds_process_tokens() 21:17:27.073382 48918 (token.c:540):tds_process_tokens(0x5794180, 0x7fff43cd8bc8, 0x7fff43cd8bcc, 0x6914) 21:17:27.073446 48918 (util.c:156):Changed query state from PENDING to READING 21:17:27.073476 48918 (net.c:1199):in tds_pull_func 21:17:37.129602 48918 (util.c:331):tdserror(0x46232c0, 0x5794180, 20003, 0) 21:17:37.129670 48918 (dblib.c:7929):dbperror(0x2e5ecb0, 20003, 0) 21:17:37.129689 48918 (dblib.c:7981):20003: "Adaptive Server connection timed out" 21:17:37.129697 48918 (dblib.c:5780):dbgetuserdata(0x2e5ecb0) 21:17:37.129718 48918 (dblib.c:4880):dbdead(0x2e5ecb0) [alive] 21:17:37.129726 48918 (dblib.c:3196):dbcancel(0x2e5ecb0) 21:17:37.129733 48918 (query.c:2155):tds_send_cancel: not in_cancel and not idle 21:17:37.129740 48918 (query.c:2164):tds_send_cancel: sending cancel packet 21:17:37.129747 48918 (net.c:741):Sending packet 21:17:37.129790 48918 (net.c:1240):in tds_push_func 21:17:37.129813 48918 (dblib.c:8002):"Adaptive Server connection timed out", client returns 1 (INT_CONTINUE) 21:17:37.129834 48918 (util.c:361):tdserror: client library returned TDS_INT_CONTINUE(1) 21:17:37.129842 48918 (util.c:384):tdserror: returning TDS_INT_CONTINUE(1) 21:17:47.076371 48918 (util.c:331):tdserror(0x46232c0, 0x5794180, 20003, 4) 21:17:47.076413 48918 (dblib.c:7929):dbperror(0x2e5ecb0, 20003, 4) 21:17:47.076427 48918 (dblib.c:7981):20003: "Adaptive Server connection timed out" 21:17:47.076437 48918 (dblib.c:5780):dbgetuserdata(0x2e5ecb0) 21:17:47.076446 48918 (dblib.c:8002):"Adaptive Server connection timed out", client returns 1 (INT_CONTINUE) 21:17:47.076455 48918 (util.c:361):tdserror: client library returned TDS_INT_CONTINUE(1) 21:17:47.076463 48918 (util.c:384):tdserror: returning TDS_INT_CONTINUE(1) 21:17:47.076489 48918 (dblib.c:5780):dbgetuserdata(0x2e5ecb0) 21:17:47.076501 48918 (dblib.c:3196):dbcancel(0x2e5ecb0) 21:17:47.076510 48918 (query.c:2155):tds_send_cancel: in_cancel and not idle 21:17:47.180191 48918 (dblib.c:5780):dbgetuserdata(0x2e5ecb0) 21:17:47.180249 48918 (dblib.c:3196):dbcancel(0x2e5ecb0) 21:17:47.180263 48918 (query.c:2155):tds_send_cancel: in_cancel and not idle 21:17:57.126580 48918 (util.c:331):tdserror(0x46232c0, 0x5794180, 20003, 4) 21:17:57.126689 48918 (dblib.c:7929):dbperror(0x2e5ecb0, 20003, 4) 21:17:57.126726 48918 (dblib.c:7981):20003: "Adaptive Server connection timed out" 21:17:57.126760 48918 (dblib.c:5780):dbgetuserdata(0x2e5ecb0) 21:17:57.126793 48918 (dblib.c:8002):"Adaptive Server connection timed out", client returns 1 (INT_CONTINUE) 21:17:57.126826 48918 (util.c:361):tdserror: client library returned TDS_INT_CONTINUE(1) 21:17:57.126985 48918 (util.c:384):tdserror: returning TDS_INT_CONTINUE(1)