Random loss of altitude in Position mode

Hi!

I was recently flying my hexacopter (tarot 680 frame) with Pixhawk 4 flight controller (PX4 1.10.1 version). I know the firmware is old, but it was working fine, so I didn’t change it.

Well in the last flight, I was flying 60m high in Position mode, and then the drone started to lose altitude. I tried to increase the throttle, but the altitude did not increase. Luckily There was enough space to maneuver into a clearing, and by that time it seemed that the control was back to normal. At least I managed to land the drone safely.

Here it can be seen, that drone height starts to oscillate, around 5 min, but then stabilizes, afterwards there are some oscillations at first, ant the drone starts losing altitude before 6:40. Drone descended and did not respond to increase in throttle, but in the graph, estimated Z is jumping around by 30m in a span of few seconds.

Here is the log file:
https://logs.px4.io/plot_app?log=70e884ac-7e78-4a06-b60e-c5eb82122ba3

2 things stand out. The “Low on stack” message, that I ether did not notice before or it had just appeared. And the “EKF baro hgt timeout: reset to baro”. What could have caused it? There was practically no wind on the day of the flight. The temperature might have been a little lower than usual ( around 10 degrees C).

Next flight after that, with expensive camera removed seemed fine and controllable:
https://logs.px4.io/plot_app?log=76099b8f-00f7-478f-85ad-ca90bc99d43d

What would be the most reliable way, to keep a steady altitude for a drone in Position mode? GPS RTK maybe? I am open to recommendations, because I would like this no to happen in the future.