-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: New transaction is not allowed
PostPosted: Thu Sep 10, 2009 1:12 pm 
Newbie

Joined: Thu Sep 10, 2009 12:34 pm
Posts: 1
I have a web app that makes some asynchronous calls to save the positions of objects that can be dragged/dropped on a page (each user can have their own view). It's been running fine in production for months.

I recently changed the drag drop script - it was javascript, now it's jquery.
I staged this modified site on a VM (Win2K3), using a database on the VM (SQL 2005).
It was running just fine for a couple weeks, but this morning I got flooded with errors from the staging site (below). Recycling the app pool helped - temporarily.

I don't know if changing the script from plain old javascript to jquery had anything to do with this. No updates have been made to the staging site since last week. I've just had it running in a browser 24x7, and my users have been doing some UAT.

Google and bing are not being very helpful so I thought I'd post here and see if I get any replies.

I posted some code snippets as well as the errors. Any help would be greatly appreciated.

I have the ScriptManager on the master page:
Code:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" OnAsyncPostBackError="ScriptManager_AsyncPostBackError">
     <Services>
          <asp:ServiceReference InlineScript="true" Path="~/Services/JavascriptCalls.asmx" />
     </Services>
</asp:ScriptManager>

jquery
on aspx page:
Code:
$('#dragObj').draggable({ containment: '#container', cursor: 'move', scroll: true, snap: '.snapTarget', snapMode: 'both', snapTolerance: 20 });
$('#dragObj').hover(function(){$(this).addClass('hoverExchange'); $(this).removeClass('exchange'); }, function(){ $(this).addClass('exchange'); $(this).removeClass('hoverExchange'); });

ui.draggable.js:
Code:
(function($) {
$.widget("ui.draggable", $.extend({}, $.ui.mouse, {
.
.
.
   _mouseStop: function(event) {
.
.
.
      Services.JavaScriptCalls.UpdateExchangeCoordinates(exchgId, this.position.left, this.position.top, currentUser, view);
      return false;
   },
.
.
.
}));

Excerpt from Global.asax.cs:
Code:
public static string ServiceSessionId = Guid.NewGuid().ToString();   

Excerpt from JavaScripCalls.asmx.cs:
Code:
ExchangeManager exchangeMgr = new ExchangeManager();
ExchangeLayoutManager layoutMgr = new ExchangeLayoutManager();
         
if (!exchangeMgr.IsJoined)
     exchangeMgr.JoinSession(Global.ServiceSessionId);
if (!layoutMgr.IsJoined)
     layoutMgr.JoinSession(Global.ServiceSessionId);
.
.
.
ExchangeLayout layout = layoutMgr.GetByExchangeId(Convert.ToInt32(exchangeId), username, expanded);

if ((layout != null) && (layout.ExchangeLayoutId > 0))
{
     layout.XCoordinate = Convert.ToInt32(left);
     layout.YCoordinate = Convert.ToInt32(top);
     layoutMgr.Update(layout, actor);
}
else
{
     layout = new ExchangeLayout();
     layout.Exchange = exchangeMgr.GetExchange(Convert.ToInt32(exchangeId));
     layout.IsExpandedView = expanded;
     layout.Username = username;
     layout.XCoordinate = Convert.ToInt32(left);
     layout.YCoordinate = Convert.ToInt32(top);
     layoutMgr.Create(layout, actor);
}
.
.
.

Both Create() and Update() call Save()
Code:
public void Save(ExchangeLayout exchangeLayout)
{
     if (exchangeLayout == null)
     {
          throw new ArgumentNullException("exchangeLayout");
     }
         
     if (this.Session.Transaction == null)
     {
         using (ITransaction transaction = this.Session.BeginTransaction())
         {
               Persist(exchangeLayout);
               transaction.Commit();
          }
     }
     else
          Persist(exchangeLayout);
}
      
private void Persist(ExchangeLayout exchangeLayout)
{
     this.Session.SaveOrUpdate(exchangeLayout);
}


Quote:
General Information
*********************************************
Additional Info:
ExchangeId: 14
User: <omitted>
Left: -203
Top: -1
ExceptionManager.MachineName: myDevBox
ExceptionManager.TimeStamp: 9/10/2009 10:07:02 AM
ExceptionManager.FullName: <omitted>, Version=2.0.2.0, Culture=neutral, PublicKeyToken=b2440d664d82f6d6
ExceptionManager.AppDomainName: /LM/W3SVC/1/Root/Dashboard-3-128970677339646555
ExceptionManager.ThreadIdentity: <omitted>
ExceptionManager.WindowsIdentity: <omitted>

1) Exception Information
*********************************************
Exception Type: NHibernate.TransactionException
Message: Begin failed with SQL exception
Data: System.Collections.ListDictionaryInternal
TargetSite: Void Begin(System.Data.IsolationLevel)
HelpLink: NULL
Source: NHibernate

StackTrace Information
*********************************************
at NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel isolationLevel)
at NHibernate.Transaction.TransactionFactory.BeginTransaction(ISessionImplementor session)
at NHibernate.Impl.SessionImpl.BeginTransaction()
at <omitted>.BusinessLogic.ExchangeLayoutManager.Save(ExchangeLayout exchangeLayout) in C:\<omitted>\BusinessLogic\ExchangeLayoutManager.g.cs:line 50
at <omitted>.BusinessLogic.ExchangeLayoutManager.Update(ExchangeLayout layout, String actor) in C:\<omitted>\BusinessLogic\ExchangeLayoutManager.cs:line 52
at <omitted>.Services.JavaScriptCalls.UpdateExchangeCoordinates(String exchangeId, String left, String top, String actor, String view) in C:\<omitted>\Services\JavaScriptCalls.asmx.cs:line 67

2) Exception Information
*********************************************
Exception Type: System.Data.SqlClient.SqlException
Errors: System.Data.SqlClient.SqlErrorCollection
Class: 16
LineNumber: 1
Number: 3988
Procedure:
Server: stagingVM
State: 1
Source: .Net SqlClient Data Provider
ErrorCode: -2146232060
Message: New transaction is not allowed because there are other threads running in the session.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void OnError(System.Data.SqlClient.SqlException, Boolean)
HelpLink: NULL

StackTrace Information
*********************************************
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransaction(TransactionRequest transactionRequest, String name, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(IsolationLevel iso, String transactionName)
at System.Data.SqlClient.SqlInternalConnection.BeginTransaction(IsolationLevel iso)
at System.Data.SqlClient.SqlConnection.BeginDbTransaction(IsolationLevel isolationLevel)
at System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction()
at NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel isolationLevel)


Another error I received in the flood this morning:
Quote:
1) Exception Information
*********************************************
Exception Type: NHibernate.ADOException
Message: could not load: [<omitted>.DataObjects.Exchange#14]
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Object Load(System.Object, System.Object, NHibernate.LockMode, NHibernate.Engine.ISessionImplementor)
HelpLink: NULL
Source: NHibernate

StackTrace Information
*********************************************
at NHibernate.Persister.EntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session)
at NHibernate.Impl.SessionImpl.DoLoad(Type theClass, Object id, Object optionalObject, LockMode lockMode, Boolean checkDeleted)
at NHibernate.Impl.SessionImpl.DoLoadByClass(Type clazz, Object id, Boolean checkDeleted, Boolean allowProxyCreation)
at NHibernate.Impl.SessionImpl.Load(Type clazz, Object id)
at <omitted>.BusinessLogic.ExchangeManager.GetExchange(Int32 exchangeId) in c:\<omitted>\BusinessLogic\ExchangeManager.g.cs:line 25
at <omitted>.Services.JavaScriptCalls.UpdateExchangeCoordinates(String exchangeId, String left, String top, String actor, String view) in c:\<omitted>\Services\JavaScriptCalls.asmx.cs:line 72

2) Exception Information
*********************************************
Exception Type: System.IndexOutOfRangeException
Message: IsActive0_
Data: System.Collections.ListDictionaryInternal
TargetSite: Int32 GetOrdinal(System.String)
HelpLink: NULL
Source: System.Data

StackTrace Information
*********************************************
at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at NHibernate.Driver.NHybridDataReader.GetOrdinal(String name)
at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name)
at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner)
at NHibernate.Type.AbstractType.Hydrate(IDataReader rs, String[] names, ISessionImplementor session, Object owner)
at NHibernate.Loader.Loader.Hydrate(IDataReader rs, Object id, Object obj, ILoadable persister, ISessionImplementor session, String[][] suffixedPropertyColumns)
at NHibernate.Loader.Loader.LoadFromResultSet(IDataReader rs, Int32 i, Object obj, Key key, String suffix, LockMode lockMode, ILoadable rootPersister, ISessionImplementor session)
at NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader dr, Int32 i, ILoadable persister, String suffix, Key key, LockMode lockMode, Key optionalObjectKey, Object optionalObject, IList hydratedObjects, ISessionImplementor session)
at NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[] persisters, String[] suffixes, Key[] keys, Object optionalObject, Key optionalObjectKey, LockMode[] lockModes, IList hydratedObjects, ISessionImplementor session)
at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, IList hydratedObjects, Object optionalObject, Object optionalId, Key[] keys, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId)
at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject)
at NHibernate.Persister.EntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.