Exceptions in high concurrency.

207 views
Skip to first unread message

eyal eitan

unread,
Apr 7, 2011, 3:49:03 AM4/7/11
to structure...@googlegroups.com
Hi,
I get a lot of these errors running multi threaded environment :

StructureMap.StructureMapException: StructureMap Exception Code:  400
Unknown error ---> System.ArgumentException: Destination array is not long enough to copy all the items in the collection. Check array index and length.
   at System.Collections.Generic.Dictionary`2.ValueCollection.CopyTo(TValue[] array, Int32 index)
   at StructureMap.Graph.PluginFamily.CreateTemplatedClone(Type[] templateTypes)
   at StructureMap.PipelineGraph.createFactory(Type pluggedType)
   at StructureMap.PipelineGraph.createFactoryIfMissing(Type pluginType)
   at StructureMap.PipelineGraph.GetDefault(Type pluginType)
   at StructureMap.BuildSession.<.ctor>b__0(Type t)
   at StructureMap.Util.Cache`2.get_Item(KEY key)
   at StructureMap.BuildSession.CreateInstance(Type pluginType)
   at StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session)
   --- End of inner exception stack trace ---
   at StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session)
   at StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session)
   at StructureMap.Pipeline.ConstructorInstance.Get[T](String propertyName, BuildSession session)
   at lambda_method(Closure , IArguments )
   at StructureMap.Construction.BuilderCompiler.FuncCompiler`1.<>c__DisplayClass2.<CreateBuilder>b__0(IArguments args)
   at StructureMap.Construction.InstanceBuilder.BuildInstance(IArguments args)
   at StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder)
   at StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session)
   at StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session)
   at StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session)
   at StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance)
   at StructureMap.BuildSession.CreateInstance(Type pluginType)
   at StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session)
   at StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session)
   at StructureMap.Pipeline.ConstructorInstance.Get[T](String propertyName, BuildSession session)
   at lambda_method(Closure , IArguments )
   at StructureMap.Construction.BuilderCompiler.FuncCompiler`1.<>c__DisplayClass2.<CreateBuilder>b__0(IArguments args)
   at StructureMap.Construction.InstanceBuilder.BuildInstance(IArguments args)
   at StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder)
   at StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session)
   at StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session)
   at StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session)
   at StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance)
   at StructureMap.BuildSession.CreateInstance(Type pluginType)

System.NullReferenceException: Object reference not set to an instance of an object.

   at StructureMap.Graph.AssemblyScanner.ScanForAll(PluginGraph pluginGraph)

   at System.Collections.Generic.List`1.ForEach(Action`1 action)

   at StructureMap.Graph.PluginGraph.Seal()

   at StructureMap.PluginGraphBuilder.Build()

   at StructureMap.Container.Configure(Action`1 configure)

   at StructureMap.Container.GetNestedContainer()


each thread has its on nested container.


any help would be appreciated


Thanks eyan.



Jeremy D. Miller

unread,
Apr 7, 2011, 10:47:35 AM4/7/11
to structure...@googlegroups.com
These aren't from the same operation are they?

I'm afraid I don't have an answer for you here.  There might be a problem with something not being locked on the top one, but the real answer is that the nested container mechanics are horrifically bad and copy big data structures around to make each nested container.  This is definitely something I intend to address with 3.0 (actually the main reason that 3.0 is a big release), but it/s not going to happen quickly.

Is there any way you could throttle the number of threads?
 
Jeremy D. Miller
The Shade Tree Developer
jeremy...@yahoo.com



From: eyal eitan <eyal....@gmail.com>
To: structure...@googlegroups.com
Sent: Thu, April 7, 2011 2:49:03 AM
Subject: [sm-users] Exceptions in high concurrency.
--
You received this message because you are subscribed to the Google Groups "structuremap-users" group.
To post to this group, send email to structure...@googlegroups.com.
To unsubscribe from this group, send email to structuremap-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/structuremap-users?hl=en.

eyal eitan

unread,
Apr 13, 2011, 3:19:51 PM4/13/11
to structure...@googlegroups.com
Thanks for the reply.

I modified the code, mainly NestedContaners -> new Container + Register, it looks better.
Reply all
Reply to author
Forward
0 new messages