Strange exception on update

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
jaja1
Posts: 43
Joined: Sat Nov 15, 2014 3:27 am

Strange exception on update

Post by jaja1 » Sun Jan 29, 2017 8:36 pm

Not sure what could be causing this...I have a theory I am passing in a dt that is too small because everything worked fine up until I changed how I calculated my deltatime. Just wanted to be sure to avoid it in the future...

Code: Select all

   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at BEPUphysics.NarrowPhaseSystems.NarrowPhase.OnCreatePair(NarrowPhasePair pair)
   at BEPUphysics.NarrowPhaseSystems.NarrowPhase.AddNewNarrowPhaseObjects()
   at BEPUphysics.NarrowPhaseSystems.NarrowPhase.UpdateSingleThreaded()
   at BEPUphysics.MultithreadedProcessingStage.Update()
   at BEPUphysics.Space.DoTimeStep()
   at BEPUphysics.Space.Update(Single dt)
   at DeiesServerData.Managers.MapManager.Update() in [CENSORED]
   at DeiesServerData.Managers.MapManager.MapLoop(Object state) in [CENSORED]
   at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.TimerQueueTimer.CallCallback()
   at System.Threading.TimerQueueTimer.Fire()
   at System.Threading.TimerQueue.FireNextTimers()
   at System.Threading.TimerQueue.AppDomainTimerCallback()
EDIT: Whoops forgot to include the actual exception thrown:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in BEPUutilities.dll

Additional information: Specified argument was out of the range of valid values.

Norbo
Site Admin
Posts: 4508
Joined: Tue Jul 04, 2006 4:45 am

Re: Strange exception on update

Post by Norbo » Sun Jan 29, 2017 8:41 pm

Without any other information, I'd guess invalid asynchronous access. Space.Add, Remove, and Update should not be called simultaneously; they are not thread safe.

jaja1
Posts: 43
Joined: Sat Nov 15, 2014 3:27 am

Re: Strange exception on update

Post by jaja1 » Sun Jan 29, 2017 8:49 pm

Norbo wrote:Without any other information, I'd guess invalid asynchronous access. Space.Add, Remove, and Update should not be called simultaneously; they are not thread safe.
Thats strange.....because I just modified my current update method to do things in one thread and sequentially. I get the new states of entities (calculate velocities, add/remove entities), then I run the space update, then I check for collisions, then I send the states back to my remote clients. I can add one particular entity to my scene...everything works great. Then another entity gets added and things stop working. As a matter of fact, when I add/remove entities to the space I first add them to a queue. On each update that queue is emptied and I handle each entity accordingly. So I am definitely not adding/removing entities during the update.

Norbo
Site Admin
Posts: 4508
Joined: Tue Jul 04, 2006 4:45 am

Re: Strange exception on update

Post by Norbo » Sun Jan 29, 2017 9:07 pm

Unfortunately, this kind of problem generally requires a repro to solve. Could you reproduce the behavior in the BEPUphysicsDemos, or create a stripped down minimalist application that shows the problem so I can take a look?

jaja1
Posts: 43
Joined: Sat Nov 15, 2014 3:27 am

Re: Strange exception on update

Post by jaja1 » Sun Jan 29, 2017 9:38 pm

Funny enough...while creating the demo I figured out what I did wrong. The terrain was still being added asynchronously to the map space so that caused the exception. :lol: :oops:

jaja1
Posts: 43
Joined: Sat Nov 15, 2014 3:27 am

Re: Strange exception on update

Post by jaja1 » Sun Jan 29, 2017 10:43 pm

Upon further investigation I realized that INDEED the map terrain is being added synchronously.....so I will still recreate the demo and PM you once its ready :)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest