Closed name1e5s closed 2 years ago
I think it might be good to fix the bug on android where an infinite backtrace is returned, but I don't think that this particular solution belongs in this crate. The callback already returns a bool
to stop the traceback and that enables users to already limit their backtrace, so I don't think there's any need to introduce secret mutable state for this.
Recently I found a bug on android when I was attemping to capture stack backtrace in a rust function called by Android app through JNI. The
_Unwind_Backtrace
called our callback to push theFrame
s into aVec
with the same address(art_quick_generic_jni_trampoline + 42
) over and over again, and finally makes my device out of memory and have to kill the Android App to save the whole system. I think it's better to provide a api to make developers able to set the backtrace limit by themself, even when the backtrace is captured by third-partycrate
s.Anyone can reproduce the problem using the following demo using an arm/aarch64 device with android 7.0 ~ android 12: https://github.com/name1e5s/backtrace_oom_demo