1
Vote

AdoWorkBatchService: Accesses to _connectionsByTransaction dictionary not threadsafe

description

Running 0.3.0.0 Changeset 15876. Under load, workflows will occasionally terminate with the exception below. Additions to the _connectionsByTransaction dictionary are not protected by a lock. I'm running Persistence and Tracking with AdoWorkBatchService, UseLocalTransactions=true, with ODP.NET 2.111.6.20 against Oracle 9i 9.2.0.5.0.
 
Suggested change: Protect all accesses of _connectionsByTransaction by a lock, like this class already does with _resourceProvidersByConnectionString.
 
10/21/2008 4:03:37 PM Cat: System.Workflow.Runtime Msg: Uncaught exception escaped to the root of the workflow.
In instance 54447778-cce0-4475-a664-3950da66afd7 in activity 
Inner exception: System.Workflow.Runtime.Hosting.PersistenceException: Index was outside the bounds of the array. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary
2.Add(TKey key, TValue value)
at WFTools.Services.Batching.Ado.AdoWorkBatchService.TransactionCreated(Transaction transaction) in C:\Code\WFTools\Main\Services\Batching\Ado\AdoWorkBatchService.cs:line 90
at WFTools.Services.Batching.GenericWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback) in C:\Code\WFTools\Main\Services\Batching\GenericWorkBatchService.cs:line 43
at System.Workflow.Runtime.WorkflowExecutor.CommitTransaction(Activity activityContext)
at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)

comments