interesting. i didn't consider that. I will investigate that more. On Dec 5, 9:29 am, Lionel Orellana <[email protected]> wrote: > It seems to me your transaction is shared between requests, the Module > is probably a singleton. > > On Dec 5, 1:10 am, Jason Meckley <[email protected]> wrote: > > > I have a sporadic error that is causing my system to hang/crash. here > > are the details > > I'm using Castle Monorail with my own Nh HttpModule to open/close > > sessions > > I'm using NH & Nh.ByteCode.Castle 2.1.0.2002 and NH.SysCache2 > > 2.1.0.3001 > > I'm using TransactionScope (TS) to manage the session's transactions > > The website uses 2 different session factories. So the TS is promoted > > to a distributed transaction (if I understand TS correctly). > > > the full exception is > > Exception information: > > Exception type: InvalidOperationException > > Exception message: A TransactionScope must be disposed on the same > > thread that it was created. > > > Thread information: > > Thread ID: 5 > > Thread account name: NT AUTHORITY\NETWORK SERVICE > > Is impersonating: True > > Stack trace: at System.Transactions.TransactionScope.Dispose() > > at StockBook.Web.Infrastructure.Web.SessionModule.DisposeOfSessions > > (Object sender, EventArgs e) in ...SessionModule.cs:line 45 > > at > > System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute > > () > > at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, > > Boolean& completedSynchronously) > > > the module > > public class SessionModule : IHttpModule > > { > > private TransactionScope transaction; > > > public void Init(HttpApplication context) > > { > > context.BeginRequest += OpenSessions; > > context.EndRequest += DisposeOfSessions; > > } > > > private void OpenSessions(object sender, EventArgs e) > > { > > var options = new TransactionOptions {IsolationLevel = > > IsolationLevel.ReadCommitted}; > > transaction = new > > TransactionScope(TransactionScopeOption.Required, > > options); > > > WindsorContainerAccessorUtil > > .ObtainContainer() > > .ResolveAll<ISessionFactory>() > > .Select(f => f.OpenSession()) > > .ForEach(s => > > ManagedWebSessionContext.Bind(HttpContext.Current, > > s)); > > } > > > private void DisposeOfSessions(object sender, EventArgs e) > > { > > if (HttpContext.Current.Error == null) > > { > > transaction.Complete(); > > } > > WindsorContainerAccessorUtil > > .ObtainContainer() > > .ResolveAll<ISessionFactory>() > > .Select(f => > > ManagedWebSessionContext.Unbind(HttpContext.Current, > > f)) > > .ForEach(s => s.Dispose()) > > > //ERROR THROWN HERE > > transaction.Dispose(); > > } > > > public void Dispose() > > { > > }} > > > I'm using Rhino.ServiceBus with Rhino.Queues > > RQ uses TransactionScope to manage the service bus messaging > > I have a PostInsert, Update and Delete listener which will send a > > message, which ultimately creates a TS in RQ. I'm not sure if this is > > related because the errors only happens with urls for reading data, > > not writing. > > > Our end users say they are able to use the system, then leave a page > > open for awhile. When they come back to the system this error is > > thrown. They are only reporting this in the morning, but the logs show > > this happens throughout the day. > > > We also have Sql backups happening throughout the day as well. Could > > this effect a distributed transaction (thus effecting the TS)? > > > What is happening is clear by the exception message, I just don't > > understand how or why? Where would I look to trouble shoot this kind > > of thing?
-- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
