We have a long standing issue using a complex Qt (QML/C++) app on Android (though it may not be unique to Android), where the UI can completely freeze (after days of use). We eliminated any particular tablet hardware. We’ve also logged the entry & exit or all C++ slots and ensured that no exceptions are thrown that escape back into Qt.
When the freeze occurs, no app C++ slot is active (being executed). We have a Qt periodic timer setup that updates a timestamp and an independent std::thread watchdog looking at it. When the freeze occurs the watchdog detects the timer slot is no longer updating the timestamp.
We’ve installed a POSIX signal handler in the UI Thread that creates a stack backtrace. When the watchdog detects the UI loop is not updating the timestamp, we fire the signal and the backtrace we see is this:
Stack trace:
core::stackBacktrace() (/data/app/~~zsXNqdAopHAknf5ynTHZfA==/com.company.pendant-jUkgwaoAF-4xXHl7n6AeFw==/lib/arm64/libPendant_arm64-v8a.so)
mainUIThreadSignalHandler(int) (/data/app/~~zsXNqdAopHAknf5ynTHZfA==/com.company.pendant-jUkgwaoAF-4xXHl7n6AeFw==/lib/arm64/libPendant_arm64-v8a.so)
__kernel_rt_sigreturn ([vdso])
syscall (/apex/com.android.runtime/lib64/bionic/libc.so)
unknown (0x74ddee4730)
unknown (0x74ddee5e58)
unknown (0x74ddee5cfc)
Qt3DRender::Render::VSyncFrameAdvanceService::waitForNextFrame() (/data/app/~~zsXNqdAopHAknf5ynTHZfA==/com.company.pendant-jUkgwaoAF-4xXHl7n6AeFw==/lib/arm64/libQt53DRender_arm64-v8a.so)
However, we don’t know if the UI thread is actually indefintely blocked in waitForNextFrame()
or just happens to be there because it would spend a lot of time there generally. The Qt source for this function acquires a semaphore (with no timeout).
The question is: if the UI appears frozen, does that imply Qt is stuck in this function, or could the 3DRender still be running/looping and rendering new frames, but some other Qt thread isn’t updating any state?
I’m also wondering if the Qt3DRender is the usual code that renders the QML Item scene-graph, or if it is particular to an actual 3D Scene, as we have a 3D viewer within the app that uses Qt3D (though it isn’t in-use or visible when the freeze occurs).