Code Monkey home page Code Monkey logo

Comments (13)

andreasohlund avatar andreasohlund commented on May 18, 2024

What container are you using? ( structuremap?)
http://andreasohlund.net

http://twitter.com/andreasohlund

Date: Sun, 5 Jun 2011 14:08:13 -0700
From: [email protected]
To: [email protected]
Subject: [NServiceBus] FileLoadException (#59)

A FileLoadException (Could not load file or assembly. Access is denied.) is being thrown by the HostServiceLocator on line 25 (NServiceBus v2.5) when starting many endpoints simultaneously (Easy to repro with 20+ endpoints). This doesn't seem to be a problem with windows file system permissions or background indexers/virus scanners deadlocking the files.

Magnum.StateMachine.StateMachineException was unhandled
Message=Exception occurred in
Topshelf.Internal.ServiceController`1[[NServiceBus.Host.Internal.GenericHost,
NServiceBus.Host, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=9fc386479f8a226c]] during state Initial while handling OnStart
Source=NServiceBus.Host
StackTrace:
Server stack trace:
at Magnum.StateMachine.ExceptionActionDictionary`1.HandleException(T
stateMachine, Event event, Object parameter, Exception exception)
at Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event
event, Object parameter)
at Magnum.StateMachine.State`1.RaiseEvent(T instance, BasicEvent`1
eevent, Object value)
at Magnum.StateMachine.StateMachine`1.RaiseEvent(Event raised)
at
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext,
Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage
msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at Topshelf.Internal.ServiceControllerProxy.Start()
at Topshelf.Internal.ServiceCoordinator.Start()
at Topshelf.Internal.Hosts.ConsoleHost.Run()
at NServiceBus.Host.Program.Main(String[] args)
InnerException:
Message=Exception when starting endpoint, error has been logged. Reason:
Could not load file or assembly 'file:///MyEndpoint.dll' or one of its dependencies.
Access is denied.
Source=NServiceBus.Host
StackTrace:
at NServiceBus.Host.Internal.GenericHost.Start()
at Magnum.StateMachine.EventActionList`1.Execute(T stateMachine,
Event event, Object parameter)
InnerException:

Reply to this email directly or view it on GitHub:
#59

from nservicebus.

elliotritchie avatar elliotritchie commented on May 18, 2024

StructureMap v2.6.2

from nservicebus.

joliver avatar joliver commented on May 18, 2024

I've encountered this exact error as well--and I'm using Autofac. The trouble is that it cannot be consistently reproduced. I'm actually wondering if it's a bug in the .NET framework relative to locks during file loading...

from nservicebus.

PeterLehmann avatar PeterLehmann commented on May 18, 2024

I have seen this problem with one assembly is x64 and rest is anyCpu.
nservicebus.host is x86 and then you get this error

from nservicebus.

Bishbulb avatar Bishbulb commented on May 18, 2024

I am also experiencing this issue quite regularly. I have 12 handlers that I'm trying to start simultaneously, and about 40% of the time I get the Access is denied error.

Any more thoughts on what could be causing this?

from nservicebus.

andreasohlund avatar andreasohlund commented on May 18, 2024

We had troubles reproducing. Can you reliably reproduce the issue?

Sent from my iPhone

On 31 jan 2012, at 03:28, Dan Bishop
[email protected]
wrote:

I am also experiencing this issue quite regularly. I have 12 handlers that I'm trying to start simultaneously, and about 40% of the time I get the Access is denied error.

Any more thoughts on what could be causing this?


Reply to this email directly or view it on GitHub:
#59 (comment)

from nservicebus.

Bishbulb avatar Bishbulb commented on May 18, 2024

Yes, I can reproduce it quite regularly. It doesn't happen every time I start up a number of projects, but the problem is definitely worse as the number of projects increases above ~10. If I try to load ~20 handlers simultaneously (via F5 in Visual Studio), I will almost always get the error. This of course makes it difficult to do full integration testing on a developer machine.

On average, the handlers that I'm starting have about 20 DLLs in their \bin\Debug directory, in case that is relevant.

from nservicebus.

lcorneliussen avatar lcorneliussen commented on May 18, 2024

I also have that issue quite often. I think you should talk to the MEF team (Glenn Block); they have been fiddling alot with assembly loading. I'm quite sure that can be fixed with a combination of using separate app domains for introspection + retries.

from nservicebus.

daltondfranklin avatar daltondfranklin commented on May 18, 2024

Our project has been plagued by this issue and we have had to literally put sleep statements within the batch files that start many endpoints. I can reproduce the scenario consistently. To do so, I created a solution with 40 projects that reference only log4net and NServiceBus assemblies and have nothing other than an app.Config file and a class that implements IConfigureThisEndpoint, AsA_Publisher, IWantCustomInitialization. In order to reproduce the scenario, I run a script that clears the contents of the global assembly download cache (gacutil.exe /cdl) and then executes a powershell script that runs NServiceBus.Host.Exe from within the various build directories in my solution. Note that I am not doing anything to intentionally put anything in the GAC. Any help would be IMMENSELY appreciated.

from nservicebus.

johnsimons avatar johnsimons commented on May 18, 2024

Here is a project that replicates this issue - https://github.com/johnsimons/FileLoadException

from nservicebus.

johnsimons avatar johnsimons commented on May 18, 2024

I nearly gave up!
But then Process Monitor came to the rescue :)

from nservicebus.

daltondfranklin avatar daltondfranklin commented on May 18, 2024

I'm curious how you recognized the shadow copy service. I watched in
process monitor quite a bit myself and couldn't nail it down.

On Jul 9, 2012, at 10:07 PM, John Simons
[email protected]
wrote:

I nearly gave up!
But then Process Monitor came to the rescue :)


Reply to this email directly or view it on GitHub:
#59 (comment)

from nservicebus.

johnsimons avatar johnsimons commented on May 18, 2024

It was a lucky shot ;)

from nservicebus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.