Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 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 |
|
|
|
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.
|
|
|
|
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() ... |
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
Originally Posted by: "Marcus" 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" 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 |
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
Originally Posted by: "Kim (Kman)" 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 |
|
|
|
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 |
|
|
|
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.
|
|
|
|
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. |
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 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 |
|
|
|
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?
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 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 |
|
|
|
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.
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 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 |
|
|
|
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.