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:
	do
	{
		BpHandle CurrentData = BaseEPDatas[CurrentIndex];
		const BpHandle IsMax = isMax(CurrentData);
						
#if PERFORM_COMPARISONS
		if(!IsMax)
		{
			// Our max passed a min => stop overlap
			const BpHandle ownerId=getOwner(CurrentData);

#if 1
			if(
#if BP_SAP_USE_OVERLAP_TEST_ON_REMOVES
				Intersect2D_Handle(boxMinMax0[handle].mMinMax[0], boxMinMax0[handle].mMinMax[1], boxMinMax1[handle].mMinMax[0], boxMinMax1[handle].mMinMax[1],
						boxMinMax0[ownerId].mMinMax[0],boxMinMax0[ownerId].mMinMax[1],boxMinMax1[ownerId].mMinMax[0],boxMinMax1[ownerId].mMinMax[1])
#endif
#if BP_SAP_TEST_GROUP_ID_CREATEUPDATE
				&& (group!=asapBoxGroupIds[ownerId])
#else
				&& Object!=id1
#endif
				)
#endif
			{
				if(numPairs==maxNumPairs)
				{
					const PxU32 newMaxNumPairs=maxNumPairs*2;
					pairs = reinterpret_cast<BroadPhasePair*>(resizeBroadPhasePairArray(maxNumPairs, newMaxNumPairs, mScratchAllocator, pairs));
					maxNumPairs=newMaxNumPairs;
				}
				PX_ASSERT(numPairs<maxNumPairs);
				pairs[numPairs].mVolA=BpHandle(PxMin(handle, ownerId));
				pairs[numPairs].mVolB=BpHandle(PxMax(handle, ownerId));
				numPairs++;
				//RemovePair(handle, getOwner(*CurrentMaxData), mPairs, mData, mDataSize, mDataCapacity);
			}
		}
#endif
		startIndex--;
		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.

Thanks,
David

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.

Thanks,
David

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?

Regards,

Josh