Serious IIS Application Pool recycling bug/design flaw

< 1 2 3 4 5 > ... >
Posted: January 20, 2018 at 5:35 AM Quote #199485
This patch is for "blocked" files that have been downloaded from the internet and marked unsafe, like this -



This is not the problem I reported. I know about blocked files, I'm 100% certain none of the files are blocked. To unblock the files I simply zipped the entire NopCommerce folder then unzipped them. This clears any blocks.

The problem that I reported occurs because the application pool has an read lock on the files in 'Plugins/bin' , so when the new application pool is started (with application pool recycling enabled, which it is by default) the new application pool is unable to move/delete them.

This fix is not going to work.

The best way to fix this would be to completely remove the "shadow plugin copy" code and just let NopCommerce load the DLLs from their original location. I think andrei confirmed this code is no longer needed anyway.
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: January 20, 2018 at 11:00 AM Quote #199493
Okay I just reverted back to the production 4.00 release.  But I implemented the changes you had in that check in on the 4.00 release code base.  It does work for the one plugin I tested - MailChimp.

However, I still have major issues with any Nop-Templates plugins or themes and this is a major show stopper for us.  Their support is adamant this is a NopCommerce design problem and one they aren't sure they can do anything about.

Before the fix I was getting this error:

Application startup exception: System.Exception: Plugin 'Seven Spikes Core'. Could not load file or assembly 'Lucene.Net.Contrib.Memory.dll' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
Could not load file or assembly 'Lucene.Net.Contrib.Memory.dll' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)

After the fix I now get this error which seems even worse:

Application startup exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at <PrivateImplementationDetails>{DC530D06-193A-4127-A396-E65C4CF7FFEE}.844C5C51-2322-4FB8-B519-2B8C46E8F7A1.(Int32 , Int32 , Int32 )
   at <PrivateImplementationDetails>{DC530D06-193A-4127-A396-E65C4CF7FFEE}.844C5C51-2322-4FB8-B519-2B8C46E8F7A1.b()
   at SevenSpikes.Nop.Plugins.Core.Infrastructure.DependencyRegistrar..ctor()

I have spent multiple days on this and NEED to get the site upgraded as soon as possible. The new performance enhancements are a must for us as we are doubling down on SEO as we update our product catalog.

Thanks,

Paul
This post/answer is useful
3
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: January 21, 2018 at 2:28 AM Quote #199511
I would recommend just removing the shadow copy code. I've been waiting for the NopCommerce team to come up with a solution but I'll probably just do this myself.
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: January 22, 2018 at 11:53 AM Quote #199556
I'm seeing this error on my test server in Azure as well.  It seems like sometimes the pool recycles without a problem, and other times, it starts throwing 500 errors all over the place.

Is there a simple change to the 4.0 codebase to disable the shadow copy?  Will the system still work correctly?  I'm willing to test, but don't have the time to go through the PluginManager code at this time to figure out what it is doing and how to disable it without causing other issues.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
-- Mark
Posted: January 23, 2018 at 4:58 AM Quote #199596
I have removed the shadow copy code from PluginManager.cs, you can find my changes here -

https://pastebin.com/RABL78sb

I've only tested this on my development server at this stage, but it looks to be working fine.

I suggest doing a diff to check my changes, I am only human after all.

Will wait until production site is quiet before testing in production.

Don't forget to delete the Plugins/bin shadow directory after deploying the changes.
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: January 23, 2018 at 5:15 AM Quote #199597
Update: Everything seems to be working in production -

* Deployed code to production
* Re-enabled overlapped recycle on the application pool
* Restarted the site
* Site started up ok, loaded all of the plugins ok
* Forced application pool recycle
* No errors

Again, don't forget to delete Plugins/bin
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: January 23, 2018 at 5:37 AM Quote #199598
After reviewing Sergei-k's patch again I think I may have initially misjudged it. It looks like his solution is to create a new shadow folder with a slightly different name (by appending the date/time) every time the application starts. This should work.

However, this solution seems like a dirty hack upon another dirty hack. Can somebody from the NopCommerce team explain why the plugin shadow copy code is even necessary? Why can't we just load the plugins from their original locations?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: January 23, 2018 at 5:57 AM Quote #199599
timmit wrote:
After reviewing Sergei-k's patch again I think I may have initially misjudged it. It looks like his solution is to create a new shadow folder with a slightly different name (by appending the date/time) every time the application starts. This should work.

However, this solution seems like a dirty hack upon another dirty hack. Can somebody from the NopCommerce team explain why the plugin shadow copy code is even necessary? Why can't we just load the plugins from their original locations?


We create a shadow copy because sometimes libraries of plugin are locking and impeding to restarting app, deleting and updating plugins, etc.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Interested in the dedicated Premium support services provided by core developers? Please visit http://www.nopcommerce.com/supportservices.aspx

Regards,
Sergey Koshelev
Posted: January 23, 2018 at 8:04 AM Quote #199603
I implemented his solution and it did not work for me.  The error changed to a memory access violation.  I will try timmit's solution next and see if that works.

My issue is around anything Nop-Templates related.  I installed the MailChimp plugin on the pure 4.00 code base and it still worked so my real test is if the Nop-Templates plugins and theme all install.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: January 23, 2018 at 9:06 AM Quote #199608
Well - same problem with Timmit's solution as well.  Clearly this is a Nop-Tempaltes problem. They cannot seem to run on .NET Core in Azure.  I have a ticket with their support open and hopefully we can get a resolution soon.

If anyone here, especially on the Nop team, can help please do! The error I get with Nop-Templates plugins is below (so far it only seems to happen in their "Core" plugin):

Application startup exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at <PrivateImplementationDetails>{DC530D06-193A-4127-A396-E65C4CF7FFEE}.844C5C51-2322-4FB8-B519-2B8C46E8F7A1.(Int32 , Int32 , Int32 )
   at <PrivateImplementationDetails>{DC530D06-193A-4127-A396-E65C4CF7FFEE}.844C5C51-2322-4FB8-B519-2B8C46E8F7A1.b()
   at SevenSpikes.Nop.Plugins.Core.Infrastructure.DependencyRegistrar..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Nop.Core.Infrastructure.NopEngine.<>c.<RegisterDependencies>b__6_0(Type dependencyRegistrar) in E:\Dev\RDO\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 91
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
   at Nop.Core.Infrastructure.NopEngine.RegisterDependencies(NopConfig nopConfig, IServiceCollection services, ITypeFinder typeFinder) in E:\Dev\RDO\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 95
   at Nop.Core.Infrastructure.NopEngine.ConfigureServices(IServiceCollection services, IConfigurationRoot configuration) in E:\Dev\RDO\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 201
   at Nop.Web.Framework.Infrastructure.Extensions.ServiceCollectionExtensions.ConfigureApplicationServices(IServiceCollection services, IConfigurationRoot configuration) in E:\Dev\RDO\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ServiceCollectionExtensions.cs:line 51
   at Nop.Web.Startup.ConfigureServices(IServiceCollection services) in E:\Dev\RDO\Presentation\Nop.Web\Startup.cs:line 44
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
< 1 2 3 4 5 > ... >
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.
eCommerce CONFERENCE 2019
Learn more