Otis wrote:
.....
TransactionScope is supported in ODP.NET starting with the 11g provider, if I'm not mistaken, please check the ODP.NET docs (oracle was pretty vague about this). It could be the transaction is 'rolledback' but actually not completely rolled back inside Oracle due to MTS/DTC related stuff. The timeout is likely caused by a locked row you're trying to update which isn't possible as the row is locked by another transaction (although I'm not sure what isolation level is set as the default in your oracle machine (although I think it's likely writers block writers in your case)).
Could you verify that after the rollback the first time, the rows are indeed not locked anymore and no transactions are running inside oracle ?
Thanks for the tip. You are right the Oracle docs are vague about this. I need to research that further.
However:
I think that I may found why this happends.
If an Exception is thrown within a TransactionScope and subsequently the program exits (crash or graceful exit) then it seams to leave the db in strange state, ie. locks are not released.
Considder the following code:
void Run()
{
RunTest(true);
RunTest(false);
}
private void RunTest(bool bFail)
{
try
{
using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
{
FullSenario sen = new FullSenario();
sen.Run();
if (bFail)
throw new Exception("Lets fail");
ts.Complete();
}
}
catch (Exception e)
{
Console.WriteLine("Exception: {0}", e.Message);
}
}
The code about work fine. I can run it from a console app again and again and it works as excepted. The transaction is properly rolledback and everything is fine.
However if I change the Run() like this:
void Run()
{
RunTest(false);
RunTest(true);
}
If I run Run() from a console app and exit then I cannot run it again without running into ORA 01013. I have to wait a few minutes until Oracle cleans up then I can run it again. Strange.
I hope that this post may help someone who is going to run into this.
Asgeir