Hi again,
I’m not sure if this is still the same issue, but I found a new crash / threading issue. I get a crash (trying to access deleted memory) in:
> PhysX3CHECKED_x64.dll!physx::Sc::BodySim::isConnectedTo(const physx::Sc::ActorSim & other, bool & collisionDisabled) Line 915 C++
PhysX3CHECKED_x64.dll!physx::Sc::NPhaseCore::filterRbCollisionPair(const physx::Sc::ShapeSim & s0, const physx::Sc::ShapeSim & s1, unsigned int filterPairIndex, unsigned int & isTriggerPair, bool runCallbacks) Line 1411 C++
PhysX3CHECKED_x64.dll!physx::Sc::NPhaseCore::onOverlapFilter(physx::Sc::ElementSim * volume0, physx::Sc::ElementSim * volume1, physx::Bp::BroadPhasePair * pair) Line 216 C++
PhysX3CHECKED_x64.dll!OverlapFilterTask::runInternal() Line 6174 C++
PhysX3CHECKED_x64.dll!physx::Cm::Task::run() Line 63 C++
and in another thread I have this happening:
> PhysX3CHECKED_x64.dll!physx::Sc::ActorSim::reallocInteractions(physx::Sc::Interaction * * & mem, unsigned int & capacity, unsigned int size, unsigned int requiredMinCapacity) Line 104 C++
PhysX3CHECKED_x64.dll!physx::Sc::ActorSim::registerInteraction(physx::Sc::Interaction * interaction) Line 57 C++
PhysX3CHECKED_x64.dll!physx::Sc::TriggerInteraction::TriggerInteraction(physx::Sc::ShapeSim & tShape, physx::Sc::ShapeSim & oShape) Line 51 C++
PhysX3CHECKED_x64.dll!physx::Sc::NPhaseCore::createTriggerInteraction(physx::Sc::ShapeSim & s0, physx::Sc::ShapeSim & s1, physx::PxFlags<enum physx::PxPairFlag::Enum,unsigned short> triggerFlags) Line 874 C++
PhysX3CHECKED_x64.dll!physx::Sc::NPhaseCore::createRbElementInteraction(const physx::PxFilterInfo & finfo, physx::Sc::ShapeSim & s0, physx::Sc::ShapeSim & s1, physx::PxsContactManager * contactManager, physx::Sc::ShapeInteraction * shapeInteraction, physx::Sc::ElementInteractionMarker * interactionMarker, unsigned int isTriggerPair) Line 692 C++
PhysX3CHECKED_x64.dll!physx::Sc::NPhaseCore::createRbElementInteraction(physx::Sc::ShapeSim & s0, physx::Sc::ShapeSim & s1, physx::PxsContactManager * contactManager, physx::Sc::ShapeInteraction * shapeInteraction, physx::Sc::ElementInteractionMarker * interactionMarker) Line 727 C++
PhysX3CHECKED_x64.dll!physx::Sc::NPhaseCore::onOverlapCreated(physx::Sc::ElementSim * volume0, physx::Sc::ElementSim * volume1, const unsigned int ccdPass, physx::Bp::BroadPhasePair * pair) Line 348 C++
PhysX3CHECKED_x64.dll!physx::Sc::NPhaseCore::onOverlapCreated(const physx::Bp::AABBOverlap * pairs, unsigned int pairCount, const unsigned int ccdPass, physx::Bp::BroadPhasePair * bpPairs) Line 463 C++
PhysX3CHECKED_x64.dll!physx::Sc::Scene::finishBroadPhase(const unsigned int ccdPass, physx::PxBaseTask * continuation) Line 6479 C++
PhysX3CHECKED_x64.dll!physx::Cm::Task::run() Line 63 C++
Apologies if the line numbers don’t exactly match, I added some test code there to find out what was happening.
It seems that the interactions array isConnectedTo() is looping through gets reallocated in another thread. Disabling threading or disabling triggers seems to prevent the new crash and the old crash from happening.
Unfortunately again I don’t have a simple test case to share, but I have a test scene set up in our game where I can repro this crash quite easily.