logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
judy at Web2Market  
#1 Posted : Wednesday, November 9, 2022 11:04:29 AM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 289

Thanks: 21 times
Was thanked: 5 time(s) in 5 post(s)
We have a 9.0.6 site that went live recently and in the admin, they are getting errors like the following:
An error has occured at https://www.xxx.com/Admi...;parentId=461&id=461 View less
Exception: The request queue limit of the session is exceeded. Stack Trace: at System.Web.SessionState.SessionStateModule.QueueRef() at System.Web.SessionState.SessionStateModule.PollLockedSession() at System.Web.SessionState.SessionStateModule.GetSessionStateItem() at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I haven't seen this on another site. What could be causing it? They do have extremely long object names.

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

Joe Payne2  
#2 Posted : Wednesday, November 9, 2022 2:43:08 PM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
Usually this comes from two possibilities:

The SQL server is too busy to respond, i.e. slow database server responses to SQL queries

or

The .Net connection pool to the database is full because db connections are getting opened but not closed before the next sql request comes in

First step, log into Admin and go to Reports->System->Database. This shows you the open .Net connections. Are there a bunch, or just one or two? A bunch would indicate the db connections are not getting closed in a timely i.e. long queries, or code bugs are not properly disposing the connection to the db after it's opened.

Another thing that can help is to bump up the connection pool limit in the /App_Data/database.config, for example:
Code:
<add name="AbleCommerce" connectionString="Server=xxx.xxx.xxx.xxx;Database=yyyyyy;Uid=zzzzzz;Pwd=zzzzzzz;TransparentNetworkIPResolution=False;Max Pool Size=200" providerName="System.Data.SqlClient" />


Bumping up the connection pool size is not a solution, but it can alleviate the immediate problem until you find the root cause.

Finally, if you have access to the SQL server, you can run SQL Profiler for a few minutes. Analyze the logs with performance tuning wizard to see if certain queries are taking huge amounts of time. Then try to determine if additional indexes would improve the query performance.
charles25686713  
#3 Posted : Thursday, November 10, 2022 12:49:10 PM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 64

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
Hi (again) Joe, this post got me to thinking.

*all* of my custom DB code does something like this:

Code:
using (var cm = new SqlCommand())
{
       cm.Connection = (SqlConnection)AbleContext.Current.Database.GetSession().Connection;
       //do work
}


I interpreted the AbleContext connection to be *the* existing connection AC uses to the database, therefore I should not close it when done. (It doesn't say OpenConnection, implying it is an existing connection.) And none of my code does close it! Yet I've never run into database issues pointing to stale or excess connections.

Yet the code for .Connection states:

Code:
//
// Summary:
//     Gets the ADO.NET connection.
//
// Remarks:
//     Applications are responsible for calling commit/rollback upon the connection
//     before closing the ISession.
DbConnection Connection { get; }


Which at least somewhat indicates I should be closing the connection upon completion of my code?

I just ran a test in AC9, using some of my custom code that runs in a loop. If it were opening a connection every time, the DB report you reference would show multiple connections, yet it only shows one.

Can you or another dev please clarify the above anomaly? Evidence indicates the connection is not to be closed, but the documentation at least implies otherwise.

Thanks,
Charles
Joe Payne2  
#4 Posted : Thursday, November 10, 2022 1:18:52 PM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
That I cannot answer for you accurately, sorry. I'm not that skilled in the bottom levels of the DAL.

Curious why you don't leverage the nHibernate implementation to access your data consistent with how Able does it?
charles25686713  
#5 Posted : Thursday, November 10, 2022 1:28:30 PM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 64

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
I find nHiberate a real hassle to use. It's much much easier to query the DB directly. Especially when I have many of my own custom tables in the DB!
Joe Payne2  
#6 Posted : Friday, November 11, 2022 5:45:19 AM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
I don't disagree. I guess it depends on your goals. One-off reports or low-traffic pages will benefit little from nHibernate. But if you're doing something on the shopper side that is accessible to all traffic, the L1 and L2 caching provided by nHibernate makes a pretty big difference in page performance.

I've worked with it for so long I guess I'm just used to doing it. Plus I built some sweet CodeSmith templates that build the entire object class and repository class for any SQL table in just a few seconds. Makes it stupid-simple to wire up new custom tables into full nHibernate implementation.

Even still, nHibernate is a hassle sometimes :)
charles25686713  
#7 Posted : Friday, November 11, 2022 9:02:10 AM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 64

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
I initially tried to use nHibernate entirely for my custom code.

I eventually realized it wasn't a very good use of my time to try to figure out how to use it, when I could query the db directly, and a whole lot faster. Time is money!

That's not to say I don't use it at all. Just this week I converted something pertaining to email templates that I had working code for from AC gold that uses nHibernate. It still works, so I didn't change it.

It's good to know about the caching on the shopper side. 99% of my custom code is on the admin side.
charles25686713  
#8 Posted : Tuesday, June 20, 2023 12:41:36 PM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 64

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
I'm resurrecting this thread, as I've now seen this exception in my error logs a few times.

Based on my research, I'm not convinced it's guaranteed to be a database issue, although it trigger it.

This SO post indicates it's caused by a change in .Net behavior starting in 4.7:

https://stackoverflow.co...-the-session-is-exceeded

I read this as long DB queries (for whatever reason), could trigger it, but not necessarily.

I saw these errors in my log yesterday when I was running a fairly long running web service call for the quickbooks web connector.

I ended up adding the line in web.config in the app.settings section:

<add key="aspnet:RequestQueueLimitPerSession" value="200"/>

The SO post suggested disabling it with a very large number; I'm not sure that's wise, but I'm not sure default behavior is wise either!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.