Crash when GetNewChunk
Hi~, I found that when using Perfetto SDK on Android devices, the following issue occurs with a small probability. The log is as follows:
Revision: '0'
ABI: 'arm64'
Timestamp: 2025-09-12 09:33:40.436005646+0800
Process uptime: 9443s
Cmdline: /system/bin/traced_probes
pid: 27904, tid: 27904, name: traced_probes >>> /system/bin/traced_probes <<<
uid: 9999
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr 0x0000007c46d383d4
Abort message: '[496.852] ory_arbiter_impl.cc:193 Shared memory buffer overrun! Stalling
[496.852] ory_arbiter_impl.cc:167 Recovered from stall after 4 iterations
[496.859] ory_arbiter_impl.cc:193 Shared memory buffer overrun! Stalling
[496.859] ory_arbiter_impl.cc:167 Recovered from stall after 4 iterations
[496.873] ory_arbiter_impl.cc:193 Shared memory buffer overrun! Stalling
[496.873] ory_arbiter_impl.cc:167 Recovered from stall after 4 iterations
[497.208] ory_arbiter_impl.cc:193 Shared memory buffer overrun! Stalling
[506.653] ory_arbiter_impl.cc:203 Shared memory buffer max stall count exceeded; possible deadlock free=0 bw=3 br=0 comp=29 pages_free=0 pages_err=0 (errno: 11, Try again)'
x0 0000000000000000 x1 0000007c4c90f8f0 x2 0000007c46d7f470 x3 0000007c4c7822b7
x4 0000000000000006 x5 fffffffffa5fd1b0 x6 38303962622d6b6f x7 7f7f7f7f7f7f7f7f
x8 0000000000000001 x9 c6dfba755a1de0b5 x10 0000000000000800 x11 0000000000019dc3
x12 0000007c46d7f9c8 x13 0000000000000100 x14 000000000000000a x15 000000000000003f
x16 0000000000000001 x17 0000007c46b6a200 x18 0000007c4bc84000 x19 0000000000000000
x20 0000000000000003 x21 0000000000000000 x22 000000000000001d x23 0000007c46c57537
x24 000000000000000b x25 0000000000000000 x26 0000000000000000 x27 0000000000000001
x28 0000000000000000 x29 0000007fe2f11c60
lr 0000007c46d383d4 sp 0000007fe2f11b80 pc 0000007c46d383d4 pst 0000000080001000
11 total frames
backtrace:
#00 pc 00000000000ed3d4 /system/lib64/libperfetto.so (perfetto::SharedMemoryArbiterImpl::GetNewChunk(perfetto::SharedMemoryABI::ChunkHeader const&, perfetto::BufferExhaustedPolicy)+1080) (BuildId: dd6aef43d3cef58707231763ceaafe77)
#01 pc 00000000000f1be0 /system/lib64/libperfetto.so (perfetto::TraceWriterImpl::GetNewBuffer()+136) (BuildId: dd6aef43d3cef58707231763ceaafe77)
#02 pc 000000000008a738 /system/lib64/libperfetto.so (protozero::ScatteredStreamWriter::WriteBytesSlowPath(unsigned char const*, unsigned long)+88) (BuildId: dd6aef43d3cef58707231763ceaafe77)
#03 pc 000000000009e084 /system/lib64/libperfetto.so (perfetto::CpuReader::ParseField(perfetto::Field const&, unsigned char const*, unsigned char const*, perfetto::ProtoTranslationTable const*, protozero::Message*, perfetto::FtraceMetadata*)+3384) (BuildId: dd6aef43d3cef58707231763ceaafe77)
#04 pc 000000000009d1f8 /system/lib64/libperfetto.so (perfetto::CpuReader::ParseEvent(unsigned short, unsigned char const*, unsigned char const*, perfetto::ProtoTranslationTable const*, perfetto::FtraceDataSourceConfig const*, protozero::Message*, perfetto::FtraceMetadata*)+372) (BuildId: dd6aef43d3cef58707231763ceaafe77)
#05 pc 000000000009b5ec /system/lib64/libperfetto.so (perfetto::CpuReader::ReadAndProcessBatch(unsigned char*, unsigned long, bool, perfetto::CompactSchedBuffer*, std::__1::set<perfetto::FtraceDataSource*, std::__1::less<perfetto::FtraceDataSource*>, std::__1::allocator<perfetto::FtraceDataSource*>> const&)+1972) (BuildId: dd6aef43d3cef58707231763ceaafe77)
#06 pc 000000000009ad64 /system/lib64/libperfetto.so (perfetto::CpuReader::ReadCycle(perfetto::CpuReader::ParsingBuffers*, unsigned long, std::__1::set<perfetto::FtraceDataSource*, std::__1::less<perfetto::FtraceDataSource*>, std::__1::allocator<perfetto::FtraceDataSource*>> const&)+168) (BuildId: dd6aef43d3cef58707231763ceaafe77)
#07 pc 00000000000baafc /system/lib64/libperfetto.so (perfetto::FtraceController::ReadTick(int)+172) (BuildId: dd6aef43d3cef58707231763ceaafe77)
#08 pc 0000000000068e9c /system/lib64/libperfetto.so (perfetto::base::UnixTaskRunner::Run()+1400) (BuildId: dd6aef43d3cef58707231763ceaafe77)
#09 pc 00000000000d4f60 /system/lib64/libperfetto.so (perfetto::ProbesMain(int, char**)+972) (BuildId: dd6aef43d3cef58707231763ceaafe77)
#10 pc 000000000006af18 /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+120) (BuildId: f5f56e902108db1bd47312dbf11c9ace)
If there are any ways to avoid this? I found there is a similar issue: https://github.com/google/perfetto/issues/927
I'm wondering if there are any parameters or configurations that can limit the data source input rate of the traced_probes process? So Excess data can be discarded.
🤖 Hi @WWKy, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.
I'm wondering if there are any parameters or configurations that can limit the data source input rate of the traced_probes process? So Excess data can be discarded.
This is not to do with the SDK (which is configured to drop events by default rather than stall) but with collection of ftrace through traced_probes. The problem is you are pushing too many events through ftrace and traced_probes is unable to keep up as your scheduler is not giving it enough CPU cycles.
Reduce the number of ftrace events you are collecting to fix the problem.