Unfinished transaction committed when exiting debug mode?

  • Thread starter Thread starter Daniel Geisenhoff
  • Start date Start date
D

Daniel Geisenhoff

Hello,

when I start my ASP.NET application in debug mode and then start a
transaction and after some inserts, I stop the debug mode (without
committing and without rolling back the transaction), those records
still have been inserted into the tables.

But as of my understanding they shouldn't. The app should behave like
if I had done a rollback.

Is this s speciality of the debug mode or is this a bug? Will I have
the same behaviour when my server crashes while a transaction us
running?

Many thanks.
Daniel.
 
Daniel Geisenhoff said:
when I start my ASP.NET application in debug mode and then start a
transaction and after some inserts, I stop the debug mode (without
committing and without rolling back the transaction), those records
still have been inserted into the tables.

But as of my understanding they shouldn't. The app should behave like
if I had done a rollback.

Is this s speciality of the debug mode or is this a bug? Will I have
the same behaviour when my server crashes while a transaction us
running?

Can you reproduce the problem in a short but complete program? See
http://www.pobox.com/~skeet/csharp/complete.html for what I mean.
 
Thanks for Jon's quick response!

Hi Daniel,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you are working in debug mode, the
transaction is automatically committed if you stop the program in the
middle. If there is any misunderstanding, please feel free to let me know.

Based on my research, this is a know issue. As the abort is not guaranteed
to be synchronous, and you are checking the transaction during the actual
abort. It means that the rollback has been issued to the distributed
transaction controller, but the abort does not wait for the controller to
complete the abort with the various servers.

This is behaviour only occurs in debug mode. You can put the command in a
try catch block. If the a command in the transaction fail, you can ensure
to rollback the transaction in the catch block.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top