[freetds] Attempt to initiate a new Adaptive Server operation with results pending

LacaK lacak at zoznam.sk
Tue Feb 10 02:43:03 EST 2015


>>> Hi,
>>> I have program which uses FreeTDS db-lib.dll
>>> Now I have changed TDS version from 7.1 to 7.3 and I start receiving
>>> "Attempt to initiate a new Adaptive Server operation with results pending"
>>> in some places.
>>>
>>> For example, when I send this two commands:
>>>    "IF @@TRANCOUNT>0 ROLLBACK"
>>> followed by:
>>>    "BEGIN TRANSACTION"
>>>
>>> I get above mentioned error.
>>>
>>> I attach portion of logs for 7.1 and 7.3 version.
>>>
>>> As you can see in both cases is returned : more_results = 1 after "IF
>>> @@TRANCOUNT>0 ROLLBACK"
>>> (I do not understand why?)
>>>
>>> But in case 7.3 is error raised afterward (in 7.1 no error) Is it expected ?
>>> Can you give me some explanation what is going on ?
>>>
>>> Thanks
>>> -Laco.
>>> P.S. I resend this email to maillist, because first does not arrive there
>>> after 3 days
>>>
>> This patch fix the problem. Wrote a small test to reproduce. Testing right now.

Hi Frediano,
I can confirm, that your patch fixed the problem.
Thank you very much.

Only thing, that I do not fully understand is, why in same situation 
(with same TDS = 7.3):
   "IF @@TRANCOUNT>0 ROLLBACK" followed by "BEGIN TRANSACTION" does NOT 
work,
but
   "ROLLBACK" followed by "BEGIN TRANSACTION" does work ?

I attach logs from both situations.

Thanks
Bye
-Laco.

-------------- next part --------------
dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS)
dblib.c:1333:dbcmd(04DE9AB8, IF @@TRANCOUNT>0 ROLLBACK)
dblib.c:1339:dbcmd() bufsz = 17
dblib.c:5833:dbfreebuf(04DE9AB8)
dblib.c:1387:dbsqlexec(04DE9AB8)
dblib.c:6807:dbsqlsend(04DE9AB8)
mem.c:645:tds_free_all_results()
util.c:146:Changed query state from IDLE to QUERYING
util.c:146:Changed query state from QUERYING to PENDING
packet.c:743:Sending packet
0000 01 01 00 50 00 00 01 00-16 00 00 00 12 00 00 00 |...P.... ........|
0010 02 00 01 00 00 00 37 00-00 00 01 00 00 00 49 00 |......7. ......I.|
0020 46 00 20 00 40 00 40 00-54 00 52 00 41 00 4e 00 |F. . at .@. T.R.A.N.|
0030 43 00 4f 00 55 00 4e 00-54 00 3e 00 30 00 20 00 |C.O.U.N. T.>.0. .|
0040 52 00 4f 00 4c 00 4c 00-42 00 41 00 43 00 4b 00 |R.O.L.L. B.A.C.K.|

dblib.c:4613:dbsqlok(04DE9AB8)
dblib.c:4642:dbsqlok() not done, calling tds_process_tokens()
token.c:549:tds_process_tokens(04DEA310, 0166F22C, 0166F23C, 0x6914)
util.c:146:Changed query state from PENDING to READING
packet.c:642:Received packet
0000 04 01 00 30 00 37 01 00-fd 01 00 c0 00 00 00 00 |...0.7.. ........|
0010 00 00 00 00 00 e3 0b 00-0a 00 08 01 00 00 00 37 |........ .......7|
0020 00 00 00 fd 00 00 d2 00-00 00 00 00 00 00 00 00 |........ ........|

token.c:564:processing result tokens.  marker is  fd(DONE)
token.c:2018:tds_process_end: more_results = 1
		was_cancelled = 0
		error = 0
		done_count_valid = 0
token.c:2035:                rows_affected = 0
util.c:146:Changed query state from READING to PENDING
dblib.c:4675:dbsqlok() end status is SUCCEED
dblib.c:4686:dbsqlok() end status was success
dblib.c:1683:dbresults(04DE9AB8)
dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED)
dblib.c:1673:dbresults returning 1 (SUCCEED)
dblib.c:1333:dbcmd(04DE9AB8, BEGIN TRANSACTION)
dblib.c:1339:dbcmd() bufsz = 26
dblib.c:5833:dbfreebuf(04DE9AB8)
dblib.c:1387:dbsqlexec(04DE9AB8)
dblib.c:6807:dbsqlsend(04DE9AB8)
token.c:549:tds_process_tokens(04DEA310, 0166F0C8, 00000000, 0x2282a)
util.c:146:Changed query state from PENDING to READING
token.c:564:processing result tokens.  marker is  e3(ENVCHANGE)
token.c:830:tds_process_tokens::SET_RETURN stopping on current token
util.c:146:Changed query state from READING to PENDING
dblib.c:7909:dbperror(04DE9AB8, 20019, 0)
dblib.c:7977:dbperror: Calling dblib_err_handler with msgno = 20019; msg->msgtext = "Attempt to initiate a new Adaptive Server operation with results pending"
dblib.c:7999:dbperror: dblib_err_handler for msgno = 20019; msg->msgtext = "Attempt to initiate a new Adaptive Server operation with results pending" -- returns 2 (INT_CANCEL)
dblib.c:3207:dbcancel(04DE9AB8)
query.c:2166:tds_send_cancel: not in_cancel and not idle
packet.c:773:Sending packet
0000 06 01 00 08 00 00 01 00-                        |........|

token.c:549:tds_process_tokens(04DEA310, 0166F1A0, 00000000, 0x0)
util.c:146:Changed query state from PENDING to READING
token.c:564:processing result tokens.  marker is  e3(ENVCHANGE)
token.c:115:tds_process_default_tokens() marker is e3(ENVCHANGE)
token.c:564:processing result tokens.  marker is  fd(DONE)
token.c:2018:tds_process_end: more_results = 0
		was_cancelled = 0
		error = 0
		done_count_valid = 0
token.c:2035:                rows_affected = 0
packet.c:642:Received packet
-------------- next part --------------
dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS)
dblib.c:1333:dbcmd(04DB9AB8, ROLLBACK)
dblib.c:1339:dbcmd() bufsz = 17
dblib.c:5833:dbfreebuf(04DB9AB8)
dblib.c:1387:dbsqlexec(04DB9AB8)
dblib.c:6807:dbsqlsend(04DB9AB8)
mem.c:645:tds_free_all_results()
util.c:146:Changed query state from IDLE to QUERYING
util.c:146:Changed query state from QUERYING to PENDING
packet.c:743:Sending packet
0000 01 01 00 2e 00 00 01 00-16 00 00 00 12 00 00 00 |........ ........|
0010 02 00 01 00 00 00 3e 00-00 00 01 00 00 00 52 00 |......>. ......R.|
0020 4f 00 4c 00 4c 00 42 00-41 00 43 00 4b 00       |O.L.L.B. A.C.K.|

dblib.c:4613:dbsqlok(04DB9AB8)
dblib.c:4642:dbsqlok() not done, calling tds_process_tokens()
token.c:549:tds_process_tokens(04DBA320, 0166F22C, 0166F23C, 0x6914)
util.c:146:Changed query state from PENDING to READING
packet.c:642:Received packet
0000 04 01 00 23 00 3e 01 00-e3 0b 00 0a 00 08 01 00 |...#.>.. ........|
0010 00 00 3e 00 00 00 fd 00-00 d2 00 00 00 00 00 00 |..>..... ........|
0020 00 00 00               -                        |...|

token.c:564:processing result tokens.  marker is  e3(ENVCHANGE)
token.c:115:tds_process_default_tokens() marker is e3(ENVCHANGE)
token.c:564:processing result tokens.  marker is  fd(DONE)
token.c:2018:tds_process_end: more_results = 0
		was_cancelled = 0
		error = 0
		done_count_valid = 0
token.c:2035:                rows_affected = 0
token.c:2038:tds_process_end() state set to TDS_IDLE
util.c:146:Changed query state from READING to IDLE
util.c:86:logic error: cannot change query state from IDLE to PENDING
util.c:146:Changed query state from IDLE to PENDING
dblib.c:4675:dbsqlok() end status is SUCCEED
dblib.c:4686:dbsqlok() end status was success
dblib.c:1683:dbresults(04DB9AB8)
dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED)
dblib.c:1673:dbresults returning 1 (SUCCEED)
dblib.c:1333:dbcmd(04DB9AB8, BEGIN TRANSACTION)
dblib.c:1339:dbcmd() bufsz = 9
dblib.c:5833:dbfreebuf(04DB9AB8)
dblib.c:1387:dbsqlexec(04DB9AB8)
dblib.c:6807:dbsqlsend(04DB9AB8)
mem.c:645:tds_free_all_results()
util.c:146:Changed query state from IDLE to QUERYING
util.c:146:Changed query state from QUERYING to PENDING
packet.c:743:Sending packet
0000 01 01 00 40 00 00 01 00-16 00 00 00 12 00 00 00 |... at .... ........|
0010 02 00 00 00 00 00 00 00-00 00 01 00 00 00 42 00 |........ ......B.|
0020 45 00 47 00 49 00 4e 00-20 00 54 00 52 00 41 00 |E.G.I.N.  .T.R.A.|
0030 4e 00 53 00 41 00 43 00-54 00 49 00 4f 00 4e 00 |N.S.A.C. T.I.O.N.|

dblib.c:4613:dbsqlok(04DB9AB8)
dblib.c:4642:dbsqlok() not done, calling tds_process_tokens()
token.c:549:tds_process_tokens(04DBA320, 0166F1C8, 0166F1D8, 0x6914)
util.c:146:Changed query state from PENDING to READING
packet.c:642:Received packet
0000 04 01 00 23 00 3e 01 00-e3 0b 00 08 08 02 00 00 |...#.>.. ........|
0010 00 3e 00 00 00 00 fd 00-00 d4 00 00 00 00 00 00 |.>...... ........|
0020 00 00 00               -                        |...|

token.c:564:processing result tokens.  marker is  e3(ENVCHANGE)
token.c:115:tds_process_default_tokens() marker is e3(ENVCHANGE)
token.c:564:processing result tokens.  marker is  fd(DONE)
token.c:2018:tds_process_end: more_results = 0
		was_cancelled = 0
		error = 0
		done_count_valid = 0
token.c:2035:                rows_affected = 0
token.c:2038:tds_process_end() state set to TDS_IDLE
util.c:146:Changed query state from READING to IDLE
util.c:86:logic error: cannot change query state from IDLE to PENDING
util.c:146:Changed query state from IDLE to PENDING
dblib.c:4675:dbsqlok() end status is SUCCEED
dblib.c:4686:dbsqlok() end status was success
dblib.c:1683:dbresults(04DB9AB8)
dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED)
dblib.c:1673:dbresults returning 1 (SUCCEED)


More information about the FreeTDS mailing list