LineTraceSingleByChannel occasionally does not detect a moved object for up to 200ms

I am performing a LineTraceSingleByChannel on the world from a stationary actor every tick with the exact same start and end position. I am also moving a boxcollider in and out of its path every second using SetActorLocationAndRotation.

Most of the time it detects the object immediately, but occasionally (like once every 20 seconds or so) it takes a while to detect the object and the linetrace will not detect the moved object for up to 200ms (10-20 ticks) .

I have also tried Overlaps and sweeps with the same outcome. It happens in 4.26 & 4.27 and both in the editor and as a standalone build.

I’m not using physics substeps or any async stuff as far as I know.
Any ideas why this is happening and how to fix it to make the linetrace robust?

So… the problem seems to be with Physx going away and rebuilding the AABB tree to make queries faster. The amount of frames that the linetrace was incorrect before it fixed itself is determined by the Phys XTree Rebuild Rate project setting. The lowest I could get it down to was 8 frames. I tried everything to change this behaviour, but couldn’t find a good solution in physx. I have now switched to the chaos physics engine (UE4.27-Chaos) and it has fixed the problem for me.