• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Aaron
#1 Posted : Monday, February 27, 2012 1:30:04 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
When IIS and SQL Server are on separate servers, we've run into issues over the years that when the connection between the two servers is broken (e.g. reboot of the SQL Server), BV will not always be able to re-establish the connection. Restarting the website always fixes the problem. I'm curious, though, why this occurs. Why isn't BV able to re-establish the connection immediately after the server is available?
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Marcus
#2 Posted : Tuesday, February 28, 2012 12:41:55 PM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

Not really sure. BV should be opening up new connections but connection pooling is handled by ADO.NET to improve performance. Perhaps the connection pool is sending bad connections back for use.

In BV5 or MerchantTribe? We switched to EF in MerchantTribe which handles the ADO.NET connections itself.
Kman
#3 Posted : Wednesday, February 29, 2012 10:48:01 AM(UTC)
Kman

Rank: Member

Joined: 11/25/2003(UTC)
Posts: 370

Aaron, are you logging any exceptions with this issue?
Something like the one below.
Exception: System.InvalidOperationException Message: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. Source: System.Data at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() ...
Regards,
Kim(Kman) Rossey
www.toocoolwebs.com
BVSoftware - MerchantTribe Programming/Design, Database Programming and Business Applications
[email protected]
Aaron
#4 Posted : Wednesday, February 29, 2012 11:13:11 AM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Originally Posted by: "Marcus" Go to Quoted Post
Perhaps the connection pool is sending bad connections back for use.

That's always been my guess. Is there any way to combat this (e.g. detect the scenario and clear the connection pool)?

Originally Posted by: "Marcus" Go to Quoted Post
In BV5 or MerchantTribe?

BV 5.X (we've had this happen on various versions, including 5.8)
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Aaron
#5 Posted : Wednesday, February 29, 2012 11:27:06 AM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Originally Posted by: "Kim (Kman)" Go to Quoted Post
Aaron, are you logging any exceptions with this issue?
Something like the one below.
Exception: System.InvalidOperationException Message: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. Source: System.Data at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() ...


Nope, there is nothing in the Audit log that shows a cause for the error. Upon closer inspection I believe that the database connection must be working fine, at least after the 'event', because errors are being logged the entire time, users can log into the admin, etc. When this happens the site reverts to the base Bvc5 theme. Could it be that the WebAppSettings class isn't being loaded properly on application start due to the SQL Server being inaccessible (and is instead using the default values), and since these values are stored in memory rather than being loaded from the database each time, the only way to force these values to reload is to restart the application?
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
toolsup
#6 Posted : Wednesday, February 29, 2012 12:11:29 PM(UTC)
toolsup

Rank: Member

Joined: 1/19/2005(UTC)
Posts: 49

I had a issue with the Theme changing to the BV5 theme this weekend.
I was getting the following error repeatedly in the error log.

BV 5.6

Object reference not set to an instance of an object.[ at BVSoftware.Bvc5.Core.BusinessRules.ProductTasks.ApplySales.Execute(ProductTaskContext context) in c:\workspaces\super8x64\BVCommerce\Main\App\source\BVSoftware.Bvc5.Core\BusinessRules\ProductTasks\ApplySales.vb:line 49 at BVSoftware.Bvc5.Core.BusinessRules.ProductTask.Execute(TaskContext context) in c:\workspaces\super8x64\BVCommerce\Main\App\source\BVSoftware.Bvc5.Core\BusinessRules\ProductTask.vb:line 7 at BVSoftware.Bvc5.Core.BusinessRules.Workflow.Run(TaskContext c) in c:\workspaces\super8x64\BVCommerce\Main\App\source\BVSoftware.Bvc5.Core\BusinessRules\Workflow.vb:line 59 ]
Thanks Matt
Marcus
#7 Posted : Wednesday, February 29, 2012 1:15:46 PM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

Yes, it is possible that if the app restarts while SQL is unavailable then it has an invalid copy of webappsettings. We cache web app settings in BV5 but for MerchantTribe went back to request scope for them.
Kman
#8 Posted : Wednesday, February 29, 2012 11:06:59 PM(UTC)
Kman

Rank: Member

Joined: 11/25/2003(UTC)
Posts: 370

You know come to think of it occasionally I have had an issue with themes and a recycle of the app pool fixes it. Rare but it has happened.

The only way I currently see of working with this issue if it is a problem is to eliminate the use of the cache. If you wanted to explore this look at \BVSoftware.Bvc5.Core\WebAppSettings.vb, Public Shared Function GetStringSetting(ByVal settingName As String) As String

I played around with it locally on a test site and did not notice much if any performance issues with not using the cache.

Caching of products was eliminated some time ago but perhaps on some installs the use of cache may not be the best option for other settings as well.
Regards,
Kim(Kman) Rossey
www.toocoolwebs.com
BVSoftware - MerchantTribe Programming/Design, Database Programming and Business Applications
[email protected]
Aaron
#9 Posted : Saturday, March 24, 2012 5:14:22 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
I'm testing a fix now that I believe will prevent this from happening. I was able to retain the caching and implement the fix without modifying the Core. Assuming it works, I will be rolling this into the next release of our free toolkit
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Steve95
#10 Posted : Friday, November 16, 2012 11:43:32 AM(UTC)
Steve95

Rank: Member

Joined: 4/29/2010(UTC)
Posts: 256

Thanks: 4 times
Was thanked: 11 time(s) in 10 post(s)
Hi Aaron, where is the fix in the tool kit?
Aaron
#11 Posted : Friday, November 16, 2012 2:10:32 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
We did put the fix into production on one of our client sites, but we were never able to determine whether it fixed the problem. Granted, I don't think we've had a problem since then so...

The toolkit I'm referring to is our free plugin set: http://www.merchanttribe.com/forums/default.aspx?f=91&m=64862. However, the fix is not included at this point since we were not sure that it actually fixed the problem.
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Steve95
#12 Posted : Tuesday, November 20, 2012 5:35:38 AM(UTC)
Steve95

Rank: Member

Joined: 4/29/2010(UTC)
Posts: 256

Thanks: 4 times
Was thanked: 11 time(s) in 10 post(s)
Aaron, could you possibly divulge what area the fix was? I seem to have a very similar issue with one of my sites.
Aaron
#13 Posted : Tuesday, November 20, 2012 9:59:35 AM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,393
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
In a nutshell, here's what we did, but please remember that we have never confirmed that this fix actually resolves the problem when it occurs.


First, add a new record to the bvc_WebAppSetting table with a SettingName of "WebAppSettingsLoaded" and a SettingValue of "1". Then add the following code to the end of the Application_BeginRequest method in Global.asax:

Code:

If Not WebAppSettings.GetBooleanSetting("WebAppSettingsLoaded") Then
If WebAppSettings.Load() AndAlso WebAppSettings.GetBooleanSetting("WebAppSettingsLoaded") Then
AuditLog.LogEvent(BVSoftware.Commerce.Metrics.AuditLogSourceModule.Plugins, BVSoftware.Commerce.Metrics.AuditLogEntrySeverity.Success, "EnsureWebAppSettingsLoaded", "WebAppSettings successfully reloaded")
Else
AuditLog.LogEvent(BVSoftware.Commerce.Metrics.AuditLogSourceModule.Plugins, BVSoftware.Commerce.Metrics.AuditLogEntrySeverity.Failure, "EnsureWebAppSettingsLoaded", "Unable to reload WebAppSettings")
End If
End If


What this should do is detect when the WepAppSettings data is not loaded from the database (and the default values are used instead). Then it should force a reload of the WebAppSettings from the database. When it does this it logs the success or failure to the Audit Log so you should be able to tell whether this worked the next time your site experiences the problem.
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
Steve95
#14 Posted : Wednesday, November 21, 2012 4:11:09 AM(UTC)
Steve95

Rank: Member

Joined: 4/29/2010(UTC)
Posts: 256

Thanks: 4 times
Was thanked: 11 time(s) in 10 post(s)
Thanks Aaron, quite a nice solution. I will give it a try and report back.
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.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012