TransactionScope issues

Topics: Troubleshooting
Feb 21, 2012 at 8:55 PM

Hi guys,

Today, I took the 1.x branch modules and put them into my 1.3.10 site, I took as many as I could, without updating the .dll, as I wanted to have as many modules updated before I move to 1.4 in a month or so.

Now I don't know if this is related, since I've been doing other coding the past few days, fixing bugs etc, now I came to finishing up and starting to test, now I'm getting these issues, I don't really want to roll back all my changes, rather get some advice on thoughts.

 

Now I keep getting two errors.

Exception information: 
    Exception type: InvalidOperationException 
    Exception message: TransactionScope nested incorrectly.
   at System.Transactions.TransactionScope.Dispose()
   at Orchard.Data.TransactionManager.System.IDisposable.Dispose() in c:\Users\sebros\Desktop\1.3.10\src\Orchard\Data\TransactionManager.cs:line 47
   at Autofac.Core.Disposer.Dispose(Boolean disposing)
   at Autofac.Util.Disposable.Dispose()
   at Autofac.Core.Lifetime.LifetimeScope.Dispose(Boolean disposing)
   at Autofac.Util.Disposable.Dispose()
   at Orchard.Mvc.Routes.ShellRoute.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in c:\Users\sebros\Desktop\1.3.10\src\Orchard\Mvc\Routes\ShellRoute.cs:line 151
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Thread information: 
    Thread ID: 9 
    Thread account name: xxxx
    Is impersonating: False 
    Stack trace:    at System.Transactions.TransactionScope.Dispose()
   at Orchard.Data.TransactionManager.System.IDisposable.Dispose() in c:\Users\sebros\Desktop\1.3.10\src\Orchard\Data\TransactionManager.cs:line 47
   at Autofac.Core.Disposer.Dispose(Boolean disposing)
   at Autofac.Util.Disposable.Dispose()
   at Autofac.Core.Lifetime.LifetimeScope.Dispose(Boolean disposing)
   at Autofac.Util.Disposable.Dispose()
   at Orchard.Mvc.Routes.ShellRoute.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in c:\Users\sebros\Desktop\1.3.10\src\Orchard\Mvc\Routes\ShellRoute.cs:line 151
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

and

 

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 21/02/2012 18:52:01 
Event time (UTC): 21/02/2012 18:52:01 
Event ID: 840ac0e8516b402d83f330667d0ecb73 
Event sequence: 1018 
Event occurrence: 2 
Event detail code: 0 
 
Application information: 
    Application domain: /LM/W3SVC/10/ROOT-9-129743225009990730 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: xxx
    Machine name: xxx
 
Process information: 
    Process ID: 9668 
    Process name: w3wp.exe 
    Account name: xxx
 
Exception information: 
    Exception type: ObjectDisposedException 
    Exception message: Cannot access a disposed object.
Object name: 'TransactionScope'.
   at System.Transactions.TransactionScope.Complete()
   at Orchard.Data.TransactionManager.System.IDisposable.Dispose() in c:\Users\sebros\Desktop\1.3.10\src\Orchard\Data\TransactionManager.cs:line 43
   at Autofac.Core.Disposer.Dispose(Boolean disposing)
   at Autofac.Util.Disposable.Dispose()
   at Autofac.Core.Lifetime.LifetimeScope.Dispose(Boolean disposing)
   at Autofac.Util.Disposable.Dispose()
   at Orchard.Environment.DefaultOrchardHost.DisposeShellContext() in c:\Users\sebros\Desktop\1.3.10\src\Orchard\Environment\DefaultOrchardHost.cs:line 196
   at Orchard.Environment.DefaultOrchardHost.b__6(AcquireContext`1 ctx) in c:\Users\sebros\Desktop\1.3.10\src\Orchard\Environment\DefaultOrchardHost.cs:line 184
   at Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in c:\Users\sebros\Desktop\1.3.10\src\Orchard\Caching\Cache.cs:line 57
   at Orchard.Caching.Cache`2.UpdateEntry(CacheEntry currentEntry, TKey k, Func`2 acquire) in c:\Users\sebros\Desktop\1.3.10\src\Orchard\Caching\Cache.cs:line 33
   at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory)
   at Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in c:\Users\sebros\Desktop\1.3.10\src\Orchard\Caching\Cache.cs:line 17
   at Orchard.Environment.DefaultOrchardHost.BeginRequest() in c:\Users\sebros\Desktop\1.3.10\src\Orchard\Environment\DefaultOrchardHost.cs:line 208
   at Orchard.WarmupStarter.Starter`1.OnBeginRequest(HttpApplication application) in c:\Users\sebros\Desktop\1.3.10\src\Orchard.Startup\Starter.cs:line 68

Now I get this when I open up all my search results 

http://www.chefandbrewer.com/find/pubs/

On my local box and open say the first 20, I'll get this issue.

Now I thought it was to do with ContentManager, so I swapped out getting it via Constructor Injection to orchardServices.WorkContext.Resolve<IContentManager>() (IIRC)

Seemed to still occur.

I tried attaching a debugger to catch the exception to see where it was being called from, it seemed to happen when I first loaded the site and requested 20 pubs straight away. It doesn't seem to happen (yet) on our dev server box, I tried hammering it with SEO Toolkit.

Now I saw that there was a *fix* but should've been in 1.3.10 which I have, or it could be a module and I could take all the modules out (since there weren't any migrations when I loaded) and put the old ones back in and upgrade them one by one to repo. Or it's my code and I need to redo some logic somewhere, any help would be great!

Cheers, Sarkie.

Coordinator
Feb 22, 2012 at 12:34 AM

Are you sure you updated all modules to be consistent with the 1.x that you took?

Feb 22, 2012 at 1:08 PM

I thought I did, but by rolling back them all and just using 1.3.10 modules, the issue has gone away, when I upgrade to 1.4 I'll see if I get the issue.

Cheers to seb for helping me!