Hi
I'm currently using BEPU for a project where I need multiple instances of BEPU running in the same program at the same time, they are completely isolated with no interaction between them.
However, it's still crashing, usually in the deactivition manager in the add and remove functions. All instances of BEPU is single threaded.
Does BEPU support running multiple instances? And what can be done to solve this problem?
A bit more specific: For every entity for every frame, I apply a random impulse to it. And thus, it crashes. It also crash if I set AngularMomentum to some value.
Even more specific: It only crashes when using multiple instances and I call ApplyAngularImpulse AND AppleLinearImpulse
Running multiple instances of BEPU is crashing
-
- Posts: 8
- Joined: Thu Mar 15, 2012 11:40 am
Re: Running multiple instances of BEPU is crashing
It should work just fine, but I have reproduced the problem. I'll post again with more information/a workaround/a fix when I know more.Does BEPU support running multiple instances? And what can be done to solve this problem?
-
- Posts: 8
- Joined: Thu Mar 15, 2012 11:40 am
Re: Running multiple instances of BEPU is crashing
Thanks, looking forward to your reply.
Re: Running multiple instances of BEPU is crashing
A quick status update: I'm still narrowing down possibilities. Unfortunately, this involves hundreds/thousands of automated tests. It might be a while 

Re: Running multiple instances of BEPU is crashing
Apparently, there exists a gap in the recycling of stale narrow phase pairs and pairs become available for reuse prematurely. Under normal circumstances, this gap cannot be exploited as it is within the execution of the engine. However, when running multiple updates in parallel, the shared resource pool will be accessed.
Incidentally, certain updateables that run within this gap (like character controllers) can trigger issues even without multithreading. This helps explain some very rare bugs I noticed in a separate project's character implementation
Now that I've finally identified the (likely) source of the issue, I should be able to get a fix into the development version in the next couple of days.
Incidentally, certain updateables that run within this gap (like character controllers) can trigger issues even without multithreading. This helps explain some very rare bugs I noticed in a separate project's character implementation

Now that I've finally identified the (likely) source of the issue, I should be able to get a fix into the development version in the next couple of days.
Re: Running multiple instances of BEPU is crashing
The development version contains a fix: http://bepuphysics.codeplex.com/SourceC ... evelopment
I've still got some more testing to do, but it looks solid.
I've still got some more testing to do, but it looks solid.
-
- Posts: 8
- Joined: Thu Mar 15, 2012 11:40 am
Re: Running multiple instances of BEPU is crashing
Works perfectly with that update. Thank you for a quick update.