Re: DB-Lib error message 20017, severity 9:Unexpected EOF from the server

"Wagner, Steve" <[email protected]> Fri, 22 Dec 2017 19:30:40 +0000
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Thanks for the response.

We decided to move to pyodbc since we couldn't find an answer.  

Steve


-----Original Message-----
From: FreeTDS [mailto:[email protected]] On Behalf Of Frediano Ziglio
Sent: Friday, December 22, 2017 10:39 AM
To: FreeTDS Development Group <[email protected]>
Subject: Re: [freetds] DB-Lib error message 20017, severity 9:Unexpected EOF from the server

No idea. A failing log would help, no idea how to get one without enabling logs everywhere.
Code sending garbage should not be that intermittent unless if a really specific condition.
About a possible firewall difference can be a firmwate update or a different configuration.
If this happened just after the update I would try to narrow down the change like updating only pymssql or only Python. I suppose you updated the system entirely and you got all a set of updates.

Frediano


2017-12-18 20:44 GMT+00:00 Wagner, Steve <[email protected]>:
> Right, that was fairly obvious.  The question is why these errors started showing up after working fine for 2+ years.
>
> Steve
>
> -----Original Message-----
> From: FreeTDS [mailto:[email protected]] On Behalf Of 
> Frediano Ziglio
> Sent: Saturday, December 16, 2017 9:18 AM
> To: FreeTDS Development Group <[email protected]>
> Subject: Re: [freetds] DB-Lib error message 20017, severity 
> 9:Unexpected EOF from the server
>
> 2017-11-28 21:40 GMT+00:00 Wagner, Steve <[email protected]>:
>> We've been using pymssql and FreeTDS for over 2 years now without problems.  We recently upgraded pymssql to 2.1.3 and also from Python 3.4 to 3.6.  Since that upgrade we've been getting the following error intermittently (but frequently).
>>
>> (20017, b'DB-Lib error message 20017, severity 9:\nUnexpected EOF 
>> from the server (FBOps-Prod:1433)\nDB-Lib error message 20002, 
>> severity 9:\nAdaptive Server connection failed (FBOps-Prod:1433)\n')
>>
>
> This usually means server closed the connection. This can happen if there's a firewall between or if client send some garbage.
>
>> There is no apparent pattern to the failures that we have been able to discover.  Well over 95% of the DB calls succeed.  It can fail on any stored proc or sql query.
>>
>> The database calls apparently do not even get to the database because nothing shows up in any DB log or trace.
>>
>> I've scoured the web and come up empty.
>>
>> I've reinstalled pymssql and FreeTDS but it still fails.
>>
>> Failures occur when connected to a DB server that is remote to the app but when connected to localhost.
>>
>> I've checked max number of connections and it's 4096 which should be plenty as there are no more than 10 active users at a time.
>>
>> Below is an excerpt from the TDS log file (full log file at the end).
>>
>>
>> packet.c:639:Received packet
>>
>>
> .......
>>
>>
>> dblib.c:6845:dbsqlsend(000000000775B3B0)
>>
>>
>> mem.c:648:tds_free_all_results()
>>
>>
>> util.c:165:Changed query state from IDLE to WRITING
>>
>>
>> util.c:165:Changed query state from WRITING to PENDING
>>
>>
>> packet.c:740:Sending packet
>>
>>
>> 0000 01 01 00 1c 00 00 01 00-42 00 45 00 47 00 49 00 |........
>> B.E.G.I.|
>>
>>
>> 0010 4e 00 20 00 54 00 52 00-41 00 4e 00             |N. .T.R. A.N.|
>>
>>
>>
>>
>> dblib.c:4625:dbsqlok(000000000775B3B0)
>>
>>
>> dblib.c:4654:dbsqlok() not done, calling tds_process_tokens()
>>
>>
>> token.c:550:tds_process_tokens(00000000075359E0, 000000000A58BBA8, 
>> 000000000A58BBA0, 0x6914)
>>
>>
>> util.c:165:Changed query state from PENDING to READING
>>
>>
>> packet.c:639:Received packet
>>
>>
>> 0000 04 01 00 11 00 4e 01 00-fd 00 00 d4 00 00 00 00 |.....N..
>> ........|
>>
>>
>> 0010 00                     -                        |.|
>>
>>
>
> Here server replied correctly so accepted the query.
>
>>
>>
>> token.c:565:processing result tokens.  marker is  fd(DONE)
>>
>>
>> token.c:2081:tds_process_end: more_results = 0
>>
>>
>>       was_cancelled = 0
>>
>>
>>       error = 0
>>
>>
>>       done_count_valid = 0
>>
>>
>> token.c:2098:                rows_affected = 0
>>
>>
>> token.c:2101:tds_process_end() state set to TDS_IDLE
>>
>>
>> util.c:165:Changed query state from READING to IDLE
>>
>>
>> util.c:83:logic error: cannot change query state from IDLE to PENDING
>>
>>
>> util.c:165:Changed query state from IDLE to IDLE
>>
>>
>> dblib.c:4687:dbsqlok() end status is SUCCEED
>>
>>
>> dblib.c:4698:dbsqlok() end status was success
>>
>>
>> dblib.c:1689:dbresults(000000000775B3B0)
>>
>>
>> dblib.c:1694:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED)
>>
>>
>> dblib.c:1679:dbresults returning 1 (SUCCEED)
>>
>>
>> dblib.c:2772:dbcount(000000000775B3B0)
>>
>>
>> dblib.c:3203:dbcancel(000000000775B3B0)
>>
>>
>> query.c:2189:tds_send_cancel: not in_cancel and idle
>>
>>
>> dblib.c:1463:dbclose(000000000775B3B0)
>>
>
> Here client is closing the connection, in this case there's no "Unexpected EOF".
>
>>
>> dblib.c:243:dblib_del_connection(000007FEF8B0FA70, 00000000075359E0)
>>
>>
>> query.c:3772:tds_disconnect()
>>
>>
>> util.c:165:Changed query state from IDLE to DEAD
>>
>>
>> mem.c:648:tds_free_all_results()
>>
>>
>> dblib.c:290:dblib_release_tds_ctx(1)
>>
>>
>> dblib.c:5873:dbfreebuf(000000000775B3B0)
>>
>>
>> Steve
>>
>
> Looks like this log is correct and do not present the error you are reporting.
>
> Frediano
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.ibiblio.org
> _mailman_listinfo_freetds&d=DwICAg&c=vR7hPPKGMb3Dfu46XtMMgQ&r=je4dO7AL
> eRs9qC-IdE73W0NJmM3ANuI-8MLiQOInOqc&m=4CYqillzKz8R49n7FsOKRo7ymawoDbgL
> 9yQldOLi3uc&s=sdjthWiBW_msYeakF_MY-4YKJ-EVmR1c73Ks7F1-UsA&e=
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.ibiblio.org
> _mailman_listinfo_freetds&d=DwICAg&c=vR7hPPKGMb3Dfu46XtMMgQ&r=je4dO7AL
> eRs9qC-IdE73W0NJmM3ANuI-8MLiQOInOqc&m=UBANYr1Fhj2G-yeVj8swxsK_kapREFBJ
> LyNloQnx87k&s=oUZcw1ZN6iwb-PtIkdsm2UYwSWTS_YqaArnJoh54D9o&e=
_______________________________________________
FreeTDS mailing list
[email protected]
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.ibiblio.org_mailman_listinfo_freetds&d=DwICAg&c=vR7hPPKGMb3Dfu46XtMMgQ&r=je4dO7ALeRs9qC-IdE73W0NJmM3ANuI-8MLiQOInOqc&m=UBANYr1Fhj2G-yeVj8swxsK_kapREFBJLyNloQnx87k&s=oUZcw1ZN6iwb-PtIkdsm2UYwSWTS_YqaArnJoh54D9o&e=