PhysX 3.4 infinite loop

After migrating to 3.4 without changing anything else I now get an infinite loop randomly inside fetch results. All threads are waiting but one is stuck in a loop here inside BPBroadphaseSap.cpp starting on line 1490

// Max is moving left:
		BpHandle CurrentData = BaseEPDatas[CurrentIndex];
		const BpHandle IsMax = isMax(CurrentData);
			// Our max passed a min => stop overlap
			const BpHandle ownerId=getOwner(CurrentData);

#if 1
				Intersect2D_Handle(boxMinMax0[handle].mMinMax[0], boxMinMax0[handle].mMinMax[1], boxMinMax1[handle].mMinMax[0], boxMinMax1[handle].mMinMax[1],
				&& (group!=asapBoxGroupIds[ownerId])
				&& Object!=id1
					const PxU32 newMaxNumPairs=maxNumPairs*2;
					pairs = reinterpret_cast<BroadPhasePair*>(resizeBroadPhasePairArray(maxNumPairs, newMaxNumPairs, mScratchAllocator, pairs));
				pairs[numPairs].mVolA=BpHandle(PxMin(handle, ownerId));
				pairs[numPairs].mVolB=BpHandle(PxMax(handle, ownerId));
				//RemovePair(handle, getOwner(*CurrentMaxData), mPairs, mData, mDataSize, mDataCapacity);
		CurrentIndex = mListPrev[CurrentIndex];
		CurrentValue = BaseEPValues[CurrentIndex];
	while(ThisValue < CurrentValue);

It only happens in release builds so I can’t really dig into it much. If anyone with more knowledge of PhysX has any idea why or what could be causing it I would appreciate any insight.


What platform and build tools are you using (e.g. visual studio version, clang/gcc version etc.)?

Windows 10 and visual studio 2017

We don’t officially support VS2017 and we currently have some bug reports with Microsoft related to what appears to be one or more compiler bugs in the VC141 toolset that produce incorrect behaviour with some of our code.

Could you try using an earlier version of visual studio, e.g. VS2015 or earlier?

Note. These bugs that we’ve reported only reproduce in release builds so they appear to be related to some compiler optimisations. It is possible it is an issue with some of the settings used in PhysX rather than an error in the compiler. We should know more soon and, once we get to the bottom of it, we will release official VS2017 solutions with the SDK.

Thank you for the info, that’s good to know. Glad that it’s not my fault! I’ll probably give it a shot in 2015 later today, but I can wait for the fix.

Good to know y’all are on it, let me know if I can help at all. Only info I have is it happened while rapidly adding a crap ton of boxes while flying around the world, noticed it seemed to happen much less while not moving but further away from origin it was more likely to lock up.


Hi David,

Can you please tell me what version of PhysX you were migrating from? Can I assume that that previous version worked fine on Win10 with VS2017?