1

my transaction scope gets aborted often

my problem behind it :

when opening multiple transaction scope with different classes ,we face the error of transaction aborted,each and every class is nested and in the methods the transaction scope is initalized,but the method where the transaction scope declared is not called,but giving timeout and transaction scope gets aborted repeatedly.

My stack trace is as follows :

System.Transactions.TransactionAbortedException was caught
HResult=-2146233087 Message=The transaction has aborted.
Source=System.Transactions

StackTrace:
       at System.Transactions.TransactionStatePromotedAborted.CreateAbortingClone(InternalTransaction tx)
       at System.Transactions.DependentTransaction..ctor(IsolationLevel isoLevel, InternalTransaction internalTransaction, Boolean blocking)
       at System.Transactions.Transaction.DependentClone(DependentCloneOption cloneOption)
       at System.Transactions.TransactionScope.SetCurrent(Transaction newCurrent)
       at System.Transactions.TransactionScope..ctor(TransactionScopeOption scopeOption)
       at TrapError.ErrorDescription..ctor()
       at QueryRecordsets.FetchRecordsets..ctor()
  InnerException: System.TimeoutException
       HResult=-2146233083
       Message=Transaction Timeout
       InnerException:   

while analyzing error description it has the following info :

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 10/30/2013 9:19:31 AM 
Event time (UTC): 10/30/2013 3:49:31 AM 
Event ID: 057d425ae7424adbb9a021d856f0d3e0 
Event sequence: 14 
Event occurrence: 1 
Event detail code: 0 

Application information: 
    Application domain: /LM/W3SVC/1/ROOT/eSmartDotNet-2-130275784247371995 
    Trust level: Full 
    Application Virtual Path: /eSmartDotNet 
    Application Path: I:\Rafiq\29-10-2013\Source Code Esmart Application\ 
    Machine name: WINSERVER2012 

Process information: 
    Process ID: 4908 
    Process name: w3wp.exe 
    Account name: IIS APPPOOL\DefaultAppPool 

Exception information: 
    Exception type: HttpUnhandledException 
    Exception message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

The transaction has aborted.
   at QueryRecordsets.FetchRecordsets..ctor()
   at ASP.logincheck_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in I:\Rafiq\29-10-2013\Source Code Esmart Application\LoginCheck.aspx:line 42
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at System.Web.UI.Page.Render(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Transaction Timeout



Request information: 
    Request URL: http://localhost/eSmartDotNet/LoginCheck.aspx 
    Request path: /eSmartDotNet/LoginCheck.aspx 
    User host address: ::1 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: IIS APPPOOL\DefaultAppPool 

Thread information: 
    Thread ID: 33 
    Thread account name: IIS APPPOOL\DefaultAppPool 
    Is impersonating: False 
    Stack trace:    at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • Maybe use SQL Server Profiler to work out the query that is being executed and see if there are any obvious issues there. Once you have the query that is being executed, try running it in SSMS and examine the actual execution plan to see why it is taking so long. – Mr Moose Oct 30 '13 at 04:48
  • @MrMoose we are using oracle 11g any alternatives for it? – BlueBerry - Vignesh4303 Oct 30 '13 at 05:11
  • Sorry, I assumed you were using SQL Server due to the other MS technologies being used. I'm not sure how well it'll work with Oracle. See my answer below for my thoughts on this. I'm happy to be corrected however. – Mr Moose Oct 30 '13 at 05:49

1 Answers1

1

I'm not sure that TransactionScope will work on Oracle. My gut feel is that it is reliant on MS technologies like MS Distributed Transaction Coordinator (MSDTC). This seems to be confirmed by the MSDN documentation on the System.Transactions namespace where it states (my emphasis indicating MS technologies);

The System.Transactions infrastructure makes transactional programming simple and efficient throughout the platform by supporting transactions initiated in SQL Server, ADO.NET, MSMQ, and the Microsoft Distributed Transaction Coordinator (MSDTC). It provides both an explicit programming model based on the Transaction class, as well as an implicit programming model using the TransactionScope class, in which transactions are automatically managed by the infrastructure.

There are also a bunch of SO posts that seem to indicate they had issues getting it working with Oracle also;

Using TransactionScope with System.Data.OracleClient - TransactionAbortedException

Problems with TransactionScope and Oracle

Transaction Scope in Oracle with ASP.NET

The last link seems to indicate an Oracle specific DTC, but still doesn't offer much hope. You may need to look at other alternatives for handling transactions other than TransactionScope.

Community
  • 1
  • 1
Mr Moose
  • 5,946
  • 7
  • 34
  • 69