[freetds] v0.95.65 Session Busy Errors After Error

Ken Collins ken at metaskills.net
Mon Nov 2 20:25:55 EST 2015


This is a cross post from an issue filed on GitHub. Not sure which is preferred.

https://github.com/FreeTDS/freetds/issues/30

This is in regards to the TinyTDS (Ruby C Extension) gem. Our dblib C code works fine for 0.91 but while testing v0.95 we get unusable connections after running an invalid SQL batch like SELECT * FROM [foobar]. Error returned when trying to issue the next batch of SQL would be:

The request failed to run because the batch is aborted, this can be caused by abort signal sent from client, or another request is running in the same session, which makes the session busy.
Below is some dump output from v0.95.65. Any recommendations that stand out?

dblib.c:1338:dbcmd(0x7fce5ab9bff0, SELECT * FROM [foobar])
dblib.c:1344:dbcmd() bufsz = 18
dblib.c:5845:dbfreebuf(0x7fce5ab9bff0)
dblib.c:6817:dbsqlsend(0x7fce5ab9bff0)
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 4a 00 00 01 00-16 00 00 00 12 00 00 00 |...J.... ........|
0010 02 00 00 00 00 00 00 00-00 00 01 00 00 00 53 00 |........ ......S.|
0020 45 00 4c 00 45 00 43 00-54 00 20 00 2a 00 20 00 |E.L.E.C. T. .*. .|
0030 46 00 52 00 4f 00 4d 00-20 00 5b 00 66 00 6f 00 |F.R.O.M.  .[.f.o.|
0040 6f 00 62 00 61 00 72 00-5d 00                   |o.b.a.r. ].|

dblib.c:5743:dbgetuserdata(0x7fce5ab9bff0)
dblib.c:5743:dbgetuserdata(0x7fce5ab9bff0)
dblib.c:5743:dbgetuserdata(0x7fce5ab9bff0)
dblib.c:5743:dbgetuserdata(0x7fce5ab9bff0)
dblib.c:4625:dbsqlok(0x7fce5ab9bff0)
dblib.c:4654:dbsqlok() not done, calling tds_process_tokens()
token.c:549:tds_process_tokens(0x7fce5ab4ca90, 0x7fff5f584794, 0x7fff5f584790, 0x6914)
util.c:165:Changed query state from PENDING to READING
packet.c:639:Received packet
0000 04 01 00 6c 00 33 01 00-aa 54 00 d0 00 00 00 01 |...l.3.. ªT.Ð....|
0010 10 1d 00 49 00 6e 00 76-00 61 00 6c 00 69 00 64 |...I.n.v .a.l.i.d|
0020 00 20 00 6f 00 62 00 6a-00 65 00 63 00 74 00 20 |. .o.b.j .e.c.t. |
0030 00 6e 00 61 00 6d 00 65-00 20 00 27 00 66 00 6f |.n.a.m.e . .'.f.o|
0040 00 6f 00 62 00 61 00 72-00 27 00 2e 00 06 53 00 |.o.b.a.r .'....S.|
0050 53 00 32 00 30 00 31 00-34 00 00 01 00 00 00 fd |S.2.0.1. 4......ý|
0060 02 00 fd 00 00 00 00 00-00 00 00 00             |..ý..... ....|

token.c:564:processing result tokens.  marker is  aa(ERROR)
token.c:115:tds_process_default_tokens() marker is aa(ERROR)
token.c:2344:tds_process_msg() reading message 208 from server
token.c:2416:tds_process_msg() calling client msg handler
dbutil.c:76:_dblib_handle_info_message(0x7fce5ab845d0, 0x7fce5ab4ca90, 0x7fff5f584620)
dbutil.c:77:msgno 208: "Invalid object name 'foobar'."
dblib.c:5743:dbgetuserdata(0x7fce5ab9bff0)
dblib.c:4865:dbdead(0x7fce5ab9bff0) [alive]
dblib.c:3203:dbcancel(0x7fce5ab9bff0)
dblib.c:5743:dbgetuserdata(0x7fce5ab9bff0)
token.c:2429:tds_process_msg() returning TDS_SUCCESS
token.c:564:processing result tokens.  marker is  fd(DONE)
token.c:2080:tds_process_end: more_results = 0
    was_cancelled = 0
    error = 1
    done_count_valid = 0
token.c:2097:                rows_affected = 0
token.c:2100: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 FAIL
dblib.c:5743:dbgetuserdata(0x7fce5ab9bff0)
dblib.c:5743:dbgetuserdata(0x7fce5ab9bff0)
dblib.c:4865:dbdead(0x7fce5ab9bff0) [alive]
dblib.c:4625:dbsqlok(0x7fce5ab9bff0)
dblib.c:4654:dbsqlok() not done, calling tds_process_tokens()
token.c:549:tds_process_tokens(0x7fce5ab4ca90, 0x7fff5f5847b4, 0x7fff5f5847b0, 0x6914)
token.c:552:tds_process_tokens() state is COMPLETED
dblib.c:3203:dbcancel(0x7fce5ab9bff0)
query.c:2186:tds_send_cancel: not in_cancel and idle


More information about the FreeTDS mailing list