问题描述
我们的团队有一个问题,表现为:
Our team have got a problem that manifests as:
似乎我们开始使用来处理我们的应用程序的事务。
which seemed to appear as soon as we began using TransactionScope to handle our applications' transactions.
堆栈跟踪的顶部被捕获为:
The top part of the stacktrace is captured as:
同时MSDTC日志已更新,我使用:
At the same time the MSDTC log is updated, which I've extracted using the instructions here:
pid=7060 ;tid=7908 ;time=04/29/2013-16:38:30.269 ;seq=136 ;eventid=TRANSACTION_BEGUN ;tx_guid=60f6390c-7570-488a-97a9-2c3912c4ca3e ;"TM Identifier='(null) '" ;"transaction has begun, description :'<NULL>'"
pid=7060 ;tid=7908 ;time=04/29/2013-16:38:30.269 ;seq=137 ;eventid=RM_ENLISTED_IN_TRANSACTION ;tx_guid=60f6390c-7570-488a-97a9-2c3912c4ca3e ;"TM Identifier='(null) '" ;"resource manager #1002 enlisted as transaction enlistment #1. RM guid = 'defc4277-47a6-4cd9-b092-93a668e2097b'"
pid=7060 ;tid=7908 ;time=04/29/2013-16:38:31.658 ;seq=138 ;eventid=RECEIVED_ABORT_REQUEST_FROM_BEGINNER ;tx_guid=60f6390c-7570-488a-97a9-2c3912c4ca3e ;"TM Identifier='(null) '" ;"received request to abort the transaction from beginner"
pid=7060 ;tid=7908 ;time=04/29/2013-16:38:31.658 ;seq=139 ;eventid=TRANSACTION_ABORTING ;tx_guid=60f6390c-7570-488a-97a9-2c3912c4ca3e ;"TM Identifier='(null) '" ;"transaction is aborting"
pid=7060 ;tid=7908 ;time=04/29/2013-16:38:31.658 ;seq=140 ;eventid=RM_ISSUED_ABORT ;tx_guid=60f6390c-7570-488a-97a9-2c3912c4ca3e ;"TM Identifier='(null) '" ;"abort request issued to resource manager #1002 for transaction enlistment #1"
pid=7060 ;tid=7908 ;time=04/29/2013-16:38:31.658 ;seq=141 ;eventid=RM_ACKNOWLEDGED_ABORT ;tx_guid=60f6390c-7570-488a-97a9-2c3912c4ca3e ;"TM Identifier='(null) '" ;"received acknowledgement of abort request from the resource manager #1002 for transaction enlistment #1"
pid=7060 ;tid=7908 ;time=04/29/2013-16:38:31.658 ;seq=142 ;eventid=TRANSACTION_ABORTED ;tx_guid=60f6390c-7570-488a-97a9-2c3912c4ca3e ;"TM Identifier='(null) '" ;"transaction has been aborted"
在 RM_ENLISTED_IN_TRANSACTION 之后,您可以看到 RECEIVED_ABORT_REQUEST_FROM_BEGINNER 。
我们不明白这个中止请求是从哪来的,还是为什么被提出来。导致问题的SQL是一个简单的SELECT,我们可以通过我们的数据库客户端执行没有问题。
We can't understand where this abort request originates from, or why it was raised. The SQL causing the problem is a simple SELECT which we can execute without issue via our database client.
应用程序最常用于
The application works most of the time, only occasionally displaying this issue.
我们正在使用具有实体框架的Oracle 10.2.0.5.0。
We are using Oracle 10.2.0.5.0 with Entity Framework.
更新
根据@Astrotrain的建议,我在System.Transactions上设置了日志记录。最后一个条目是中途切断:
Following advice from @Astrotrain I set up the logging on System.Transactions. The final entry produced is literally cut off half-way though:
....
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/2004/06/System/Transactions/TransactionScopeCreated</TraceIdentifier>
<Description>TransactionScope Created</Description>
<AppDomain>BillLineGeneratorUI.exe</AppDomain>
<ExtendedData xmlns="http://schemas.microsoft.com/2004/03/Transactions/TransactionScopeCreatedTraceRecord">
<TraceSource>[Base]
您可以看到异常防止日志整理。我可以从中学到什么?任何想法?
As you can see the exception actually prevents the log finishing. What can I learn from this? Any ideas?
推荐答案
而不是使用MSDTC跟踪工具(我发现可怕的斯巴达),我可以建议使用系统。事务跟踪源 - 只需在您的web.config中包含以下内容:
如果您使用 SvcTraceViewer.exe
打开日志文件,您将获得一个不错的
Instead of using the MSDTC trace tool (which I find horribly spartan), I can recommend using the System.Transactions trace source - just include the following in your web.config:
If you open the log files with SvcTraceViewer.exe
you'll get a nice visual representation of the steps.
<configuration>
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.Transactions" switchValue="Information">
<listeners>
<add name="tx"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\MyApp-transactions-log.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
本身不是一个解决方案,但这可能会给您更多关于出现什么问题的信息。
Not a solution per se, but this might give you some more information about what goes wrong.
这篇关于TransactionScope - EnlistTransaction上的底层提供程序失败。 MSDTC被中止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!