As you can see in those 3 picture,i was using the record button to keyframe the animation and copy the rest pose to frame 77. I have no keyframe in frame 76 and things should go smooth from 75 to 77. But somehow the rig twisted like that in the middle picture. The problem only happen when i copy pose, use the I key to insert key, and return to rest pose(Alt+R,Alt+G). Edit 1: add the blend file
Okay, so the problem isn't with the constraints, but with the keyframes on "main". On frame 75, main is keyframed to a quaternion with a W component of about -0.997, but on frame 77, its W component is 1.0. That takes it through an entire rotation.
If you edit the frame 77 keyframe to set the W value equal to -1 instead of +1.0, it will stop rotating through the extra rotation on frame 76.
If your goal is rendering in Blender, this fix may interact poorly with some NLA (if you blend out the animation, or blend over an animation with a positive W.) That's a solvable problem with extra strips to hold the W at negative values, but explaining it would probably require an actual example of the problem. If your goal is game animation, it's probably not going to be an issue, as game engines tend to interpolate quaternions differently from Blender. Unlike Blender, game engines are likely to use "shortest path" quaternion interpolation, which automatically removes issues like this. (I wish that Blender could do the same thing, and hopefully, with some changes to how Blender handles quaternions that are already under discussion by developers, I'll get that wish.)