ArduCopter 4.0.3 attributes IMU failure to wrong IMU

Flying with ArduCopter 4.0.3 on two Pixhawks (one clone, one mRobotics), we have had two instances (with separate vehicles and autopilots) where gyroscope values for IMU2 are suddenly offset from near-zero (hovering flight) to random values of up to ±5 degrees. At some point (instantly in the first instance, after 11 seconds in the second) the ardupilot seemingly detects an error, but labels IMU1 faulty and starts relying on the (failed) IMU2. IMU2 continues to record stable but non-zero values, and the aircraft reacts to these, causing it to rapidly rotate and fall to the ground. IMU1 tracks these rotations just fine.

Instance one: Hexacopter, (Pixhawk clone, 2.4.8), running stock Ardupilot 4.0.3

Instance two: Quadcopter, (mRobotics Pixhawk), running stock Ardupilot 4.0.3

Note, this appears to be the same incident reported at the following link, however that was fortunately found on the ground, not in flight: Sudden gyro measurement offset

We’ve previously been using a number of pixhawk clones on quads similar to the one in instance two, with a custom firmware based on 3.7 dev. We did see occasional uncommanded rotation/descent from these, however they always recovered. This makes me suspect a software change introduced between 3.7dev and 4.0.3 is responsible. However, the other instance above is tagged as Copter 3.5. It could also be that the prior issues were actually IMU1 failures, and the error is to always switch to IMU2, and hence we were fortunate in those cases. Unfortunately, I don’t have logs at hand for those flights to confirm.

I’m aware of the similar issues with Cube Blacks, I couldn’t find exactly what was fixed there. None of the autopilots used here are Cubes: https://discuss.cubepilot.org/t/sb-0000002-critical-service-bulletin-for-cubes-purchased-between-january-2019-to-july-2019-do-not-fly/406/148

Note that I can’t currently share log files as they need to be anonymised and I haven’t got a tool for that (tried the Mission Planner one, it wasn’t sufficient). There is a log file associated with the other similar incident linked above, and the images clearly show the issue. I can provide log outputs for other variables if required.