-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transaction.rollback() fails after sql error generated by msnodesql driver #77
Comments
Thanks for the report, I have just updated known issues with that. |
I am facing a similar issue with Tedious too, but I think we can fix this in mssql.
I am nesting few requests (within callbacks, where each request executes a stored procedure) on the same transaction. Everything works fine, until processing one of those requests results in an uncaught exception. For example, trying to insert a 50 char word in a size 10 column. In such an event, when I try to rollback the transaction, it gives the same error: "TransactionError: Can't rollback transaction. There is a request in progress." main.js:
This happens because when trying to rollback, the In case of Please do let me know if you can think of another solution for this. Thanks! |
Thanks for the report, it's fixed and will be contained in 2.0 release. |
I'm using 2.3.1 and I still see this issue. I apologize for the limited information, but any insight on what I should expect with a transaction would help. Thanks |
I'm still facing the original issue - transaction that has to fail (foreign key in my example) gets stuck
"msnodesqlv8": "2.0.6", |
The option to emit |
Hi,
today I spotted a nasty issue with
Transaction
interface ofnode-mssql
not working as expected under the following conditions.Driver used:
msnodesql
(0.2.1)insert
statement).error
callback orerror
event listener (if streaming) attempt to rollback a transaction.Result: Error rolling back transaction with message "TransactionError: Can't rollback transaction. There is a request in progress." + all rows affected by that transaction remain locked (last statement should be investigated better).
Expected result: transaction gets rolled back correctly.
Diving a bit into this I found a cause, which, unfortunately, seems to be located in msnodesql's code:
msnodesql, after emitting an
error
event does not emitdone
event (as it does for positive execution cases).Thus, mssql has no chance to release a connection utilized by the call causing an sql error and, subsequently, does not mark transaction as
_working = false;
, which leads to all subsequent attempts to perform queries on that transactions to get queued and transaction operations to always complete with the abovementioned error message.I was able to workaround the case by applying the following simple patch to msnodesql's sources:
I.e. by emitting a
done
event after anerror
one. Unfortunately, I'm not sure this will work correctly in all occasions, but at least I was able to proceed without any noticeable glitches (yet) in my (rather simple) scenario.I understand that it is very likely that it will be confirmed that this issue resides in
msnodesql
's code (and should be addressed there), but, as we all understand, it looks pretty unlikely it will get fixed any soon.So, I think if workarounding this case on
mssql
's side is not an option, mentioning this as a known issue might at least save time for others having this pain.The text was updated successfully, but these errors were encountered: