Tiny question about MSDTC behaviour

Can MSDTC abort\rollback transaction if I create instance of COM-object (COM object marked as "Transaction - Not supported" in "Component Services" snap-in) during "transactioned" part of .NET code Which way MSTDC will act

Answer this question

Tiny question about MSDTC behaviour

  • Ioan Bizau

    We cant trace where exactly BizObjException throwns because it's happend not everytime, when service call that code but occasionally one or two during hour, or maybe not happend at all.
    We didnt notice whether it affects our system or no because we have many of parallel requests to service. And we can't repeat it on our test server. I think it's happend sometimes because of heavy load, but according to SQL trace - no long locks or deadlocks occurs in DB.
    This why I can't explain at what time and execution I get exception.
    I will try to carefully debug on our main service and try to figure more conditions when transaction rolled back



    If one method of a transactional ServicedComponent is throwing an exception, the transaction will immediately abort. You should not attempt to do any subsequent work after this as part of the transaction that was just aborted.

    Will transaction immediately abort even if I try{}catch{} exception and handle it by myself or it will abort only if exception will be thrown outside transactional component

    About enabling trace - I did't it before, but I didnt notice any usefull info (for me) in there. Maybe you can notice more.
    Here is some parts of trace when problem occurs:
    Some CM entries: this occurs when we tried to restart service, but it wasnt properly stopped, service process was killed, and started again at 11:13:46. as I understand this occurs due to second process (newly started) want to use same socket, while first one not yet released it

    05-24-2006 11:13 42:708: CM Error Value = 0x000006d9, Exception raised in the rpc call C_PokeW , .\iomgrclt.cpp (716)
    05-24-2006 11:13 42:708: CM Error Value = 0x80000171, PokeWrapper call failed, .\iomgrclt.cpp (648)

    and 11:13:48 comes with


    Exception Type: System.Data.SqlClient.SqlException
    Errors: System.Data.SqlClient.SqlErrorCollection
    Class: 16
    LineNumber: 0
    Message: Import of MSDTC transaction failed: Result Code = 0x8004d019.
    Number: 8509
    Procedure:
    Server:
    State: 1
    Source: .Net SqlClient Data Provider
    TargetSite: Void OnError(System.Data.SqlClient.SqlException, System.Data.SqlClient.TdsParserState)
    HelpLink: NULL




    Here is today error 15:08 (accoding to inner exception from trace entry - happen when
     SQLHelper (from MS App Block) ExecuteNonQuery called.
    TX entries


    pid=1004 ;tid=3124 ;time=05/25/2006-15:08:39.635 ;seq=91453 ;eventid=TRANSACTION_BEGUN ;tx_guid=B2EC9C96-CF59-4DF6-B048-0457A1EE6BB3 ;"transaction got begun, description : ASP.ObjectContextTxRequired.1"
    pid=1004 ;tid=3224 ;time=05/25/2006-15:08:39.651 ;seq=91454 ;eventid=RM_ENLISTED_IN_TRANSACTION ;tx_guid=B2EC9C96-CF59-4DF6-B048-0457A1EE6BB3 ;"resource manager #1 enlisted as transaction enlistment #1001. RM guid = {F3AF5981-6EFF-499D-8CAA-AAC997617727}"
    pid=1004 ;tid=3124 ;time=05/25/2006-15:08:39.651 ;seq=91455 ;eventid=TRANSACTION_ABORTING ;tx_guid=B2EC9C96-CF59-4DF6-B048-0457A1EE6BB3 ;"transaction is aborting"
    pid=1004 ;tid=3124 ;time=05/25/2006-15:08:39.651 ;seq=91456 ;eventid=RM_ISSUED_ABORT ;tx_guid=B2EC9C96-CF59-4DF6-B048-0457A1EE6BB3 ;"abort request issued to resource manager #1 for transaction enlistment #1001"
    pid=1004 ;tid=2328 ;time=05/25/2006-15:08:39.651 ;seq=91457 ;eventid=RM_ACKNOWLEDGED_ABORT ;tx_guid=B2EC9C96-CF59-4DF6-B048-0457A1EE6BB3 ;"received acknowledgement of abort request from the resource manager #1 for transaction enlistment #1001"
    pid=1004 ;tid=2328 ;time=05/25/2006-15:08:39.651 ;seq=91458 ;eventid=TRANSACTION_ABORTED ;tx_guid=B2EC9C96-CF59-4DF6-B048-0457A1EE6BB3 ;"transaction has got aborted"



    And maybe you can explain me - what is tid column in this log
    tx_guid - is transaction ID, pid,seq,time,event_id and last one comment is simple. But I cant understand what is tid , and why in log so many repeated (tid values I mean) tids for different transactions

  • elf_sander

    Alexey,

    MSDTC can abort a transaction at any time. By creating a COM+ object marked "Transaction-Not Supported" you will ensure that the code that runs in that component will not participate in the transaction of the caller (if any), nor the component will create a transaction of its own.

    I don't understand what you mean by "transactioned" part of .NET code. Can you clarify

    Cheers!



  • otpiness

    We are using:
    Windows 2000 (5.00.2195 ) with SP4
    SQL Server 2000 Standart Edition (8.00.2040) also with SP4. Running on same computer with client service

    Stack traces ( 2 different, with note in there):


    General Information
    *********************************************
    Additional Info:
    ExceptionManager.MachineName: REGSERVER1
    ExceptionManager.TimeStamp: 24.05.2006 10:22:13
    ExceptionManager.FullName: Microsoft.ApplicationBlocks.ExceptionManagement, Version=1.0.1.84, Culture=neutral, PublicKeyToken=null
    ExceptionManager.AppDomainName: productservices.service.exe
    ExceptionManager.ThreadIdentity: FINE\ARbase_post
    ExceptionManager.WindowsIdentity: FINE\ARbase_post

    1) Exception Information
    *********************************************
    Exception Type: Abbyy.ActivationDatabase.ProductServices.Data.Common.BusinessObject.BusinessObjectException
    ErrorCode: DataProviderError
    Message: DataProviderError
    TargetSite: Void HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)
    HelpLink: NULL
    Source: mscorlib

    StackTrace Information
    *********************************************

    Server stack trace:
    at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.GetSerialNumberActivationStatus(String serialNumber, String installationCode) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 807
    at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.ActivateProduct(ActivationRecord activationRecord) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 95
    at System.Runtime.Remoting.Messaging.Message.Dispatch(Object target, Boolean fExecuteInContext)
    at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

    Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.ActivateProduct(ActivationRecord activationRecord) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 47
    at Abbyy.ActivationDatabase.ProductServices.ProductServiceBase.ActivateSerialNumber(ActivationRequest activationRequest, String serialNumber) in D:\Projects\ActivationRegistration\ARDB\ProductServices.v1\ProductServiceBase.cs:line 481

    2) Exception Information
    *********************************************
    Exception Type: System.Data.SqlClient.SqlException
    Errors: System.Data.SqlClient.SqlErrorCollection
    Class: 16
    LineNumber: 0
    Message: Import of MSDTC transaction failed: Result Code = 0x8004d00e.
    (and sometimes occures with Result Code = 0x8004d019)

    Number: 8509
    Procedure:
    Server:
    State: 1
    Source: .Net SqlClient Data Provider
    TargetSite: Void OnError(System.Data.SqlClient.SqlException, System.Data.SqlClient.TdsParserState)
    HelpLink: NULL

    StackTrace Information
    *********************************************
    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, TdsParserState state)
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, TdsParserState state)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
    at System.Data.SqlClient.TdsParser.Run(RunBehavior run, SqlCommand cmdHandler, SqlDataReader dataStream)
    at System.Data.SqlClient.TdsParser.PropagateDistributedTransaction(Byte[] buffer, Int32 length, Int32 timeout)
    at System.Data.SqlClient.SqlInternalConnection.EnlistNonNullDistributedTransaction(ITransaction transaction)
    at System.Data.SqlClient.SqlInternalConnection.EnlistDistributedTransaction(ITransaction newTransaction, Guid newTransactionGuid)
    at System.Data.SqlClient.SqlInternalConnection.EnlistDistributedTransaction()
    at System.Data.SqlClient.SqlInternalConnection.Activate(Boolean isInTransaction)
    at System.Data.SqlClient.SqlConnection.Open()
    at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.GetSerialNumberActivationStatus(String serialNumber, String installationCode) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 784



    ==============================================================
    Second trace


    General Information
    *********************************************
    Additional Info:
    ExceptionManager.MachineName: REGSERVER1
    ExceptionManager.TimeStamp: 24.05.2006 9:09:01
    ExceptionManager.FullName: Microsoft.ApplicationBlocks.ExceptionManagement, Version=1.0.1.84, Culture=neutral, PublicKeyToken=null
    ExceptionManager.AppDomainName: productservices.service.exe
    ExceptionManager.ThreadIdentity: FINE\ARbase_post
    ExceptionManager.WindowsIdentity: FINE\ARbase_post

    1) Exception Information
    *********************************************
    Exception Type: Abbyy.ActivationDatabase.ProductServices.Data.Common.BusinessObject.BusinessObjectException
    ErrorCode: DataProviderError
    Message: DataProviderError
    TargetSite: Void HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)
    HelpLink: NULL
    Source: mscorlib

    StackTrace Information
    *********************************************

    Server stack trace:
    at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.FindActivationRecords(String serialNumber, String installationId) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 604
    at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.ActivateProduct(ActivationRecord activationRecord) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 133
    at System.Runtime.Remoting.Messaging.Message.Dispatch(Object target, Boolean fExecuteInContext)
    at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

    Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.ActivateProduct(ActivationRecord activationRecord) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 47
    at Abbyy.ActivationDatabase.ProductServices.ProductServiceBase.ActivateSerialNumber(ActivationRequest activationRequest, String serialNumber) in D:\Projects\ActivationRegistration\ARDB\ProductServices.v1\ProductServiceBase.cs:line 481

    2) Exception Information
    *********************************************
    Exception Type: System.Data.SqlClient.SqlException
    Errors: System.Data.SqlClient.SqlErrorCollection
    Class: 20
    LineNumber: 0
    Message: Enlist of MSDTC transaction failed: Result Code = 0x8004d00e.
    Number: 8510
    Procedure:
    Server:
    State: 1
    Source: .Net SqlClient Data Provider
    TargetSite: Void OnError(System.Data.SqlClient.SqlException, System.Data.SqlClient.TdsParserState)
    HelpLink: NULL

    StackTrace Information
    *********************************************
    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, TdsParserState state)
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, TdsParserState state)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
    at System.Data.SqlClient.TdsParser.Run(RunBehavior run, SqlCommand cmdHandler, SqlDataReader dataStream)
    at System.Data.SqlClient.TdsParser.PropagateDistributedTransaction(Byte[] buffer, Int32 length, Int32 timeout)
    at System.Data.SqlClient.SqlInternalConnection.EnlistNonNullDistributedTransaction(ITransaction transaction)
    at System.Data.SqlClient.SqlInternalConnection.EnlistDistributedTransaction(ITransaction newTransaction, Guid newTransactionGuid)
    at System.Data.SqlClient.SqlInternalConnection.EnlistDistributedTransaction()
    at System.Data.SqlClient.SqlInternalConnection.Activate(Boolean isInTransaction)
    at System.Data.SqlClient.SqlConnection.Open()
    at Abbyy.ActivationDatabase.ProductServices.Data.BusinessObject.ActivationBusinessObject.FindActivationRecords(String serialNumber, String installationId) in D:\Projects\ActivationRegistration\ARDB\ProductServices.Data\BusinessObject\ActivationBusinessObject.cs:line 566



    Tell me please, if you need more information about our system

  • bennymacca

    It looks that your transactions are being aborted. This may be because of the first exception: BusinessObjectException or because of a timeout.

    If one method of a transactional ServicedComponent is throwing an exception, the transaction will immediately abort. You should not attempt to do any subsequent work after this as part of the transaction that was just aborted.

    If my answer doesn't help, please explain at what point in time & execution do you get BusinessObjectException and what do you do when you get the exception.

    One other avenue is to enable tracing to confirm where the abort is comming from: http://support.microsoft.com/Default.aspx kbid=899115

    HTH



  • hakl

    Yes, this helps. Can you also provide the stack of the exception Also what operating systems are you using Is the SQL Server on the same computer as the client

    Thanks.



  • rayfward

    Service create instances of biz objects,
    Biz objects marked with attribute [Transaction(TransactionOption.Required)].
    And we have something like this


    Main Func()
    {
    ...
    parse data
    ...
    create instance of biz object using parsed data

    call instance method method1()
    }


    and method1:


    method1()
    {
    ...
    do something
    ...
    create instance of COM (COM DLL marked as Transaction Not supported)
    ...
    call COM.Method2
    ...
    store everything to MSSQL DB
    }


    and sometimes we catch exception "Import (or Enlist
    ) of MSDTC transaction failed", which thrown up to Main and written to exception log.

    And I try to figure why this can happend and how to fix it

    Did I clarify or you need more information







  • Vimal Menon

    tid is Thread ID.

  • Tiny question about MSDTC behaviour