record_android_trace hangs on Pixel 1 and Pixel 4a
- Dominant language
- C++
- Stars
- 6.5k
- Forks
- 868
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 218
Description
**Background**
I am running the following command:
```bash
./record_android_trace -c ftrace.config -n -o output/faults.ptrace
Running perfetto --txt -o /data/misc/perfetto-traces/2025-08-13_17-37-a74680.pftrace -c -
```
On a rooted Pixel 1 and Pixel 4a, the `record_android_trace` script does not proceed further. It blocks indefinitely at this line: https://github.com/google/perfetto/blob/main/tools/record_android_trace#L624.
Interestingly, this works as expected on my unrooted Pixel 6a.
**Expected Output**
It is expected that `Trace started. Press CTRL+C to stop` is outputted and `ctrl-c` can be used to collect the trace.
**Ftrace config**
```
buffers: {
size_kb: 260096
fill_policy: DISCARD
}
buffers: {
size_kb: 2048
fill_policy: DISCARD
}
data_sources: {
config {
name: "android.packages_list"
target_buffer: 1
}
}
data_sources: {
config {
name: "linux.process_stats"
target_buffer: 1
process_stats_config {
scan_all_processes_on_start: true
}
}
}
data_sources: {
config {
name: "android.packages_list"
}
}
data_sources: {
config {
name: "linux.sys_stats"
sys_stats_config {
vmstat_period_ms: 500
vmstat_counters: VMSTAT_PGMAJFAULT
}
}
}
data_sources: {
config {
name: "linux.sys_stats"
sys_stats_config {
stat_period_ms: 1000
stat_counters: STAT_CPU_TIMES
stat_counters: STAT_FORK_COUNT
}
}
}
data_sources: {
config {
name: "linux.ftrace"
ftrace_config {
ftrace_events: "sched/sched_switch"
ftrace_events: "power/suspend_resume"
ftrace_events: "sched/sched_wakeup"
ftrace_events: "sched/sched_wakeup_new"
ftrace_events: "sched/sched_waking"
ftrace_events: "sched/sched_process_exit"
ftrace_events: "sched/sched_process_free"
ftrace_events: "task/task_newtask"
ftrace_events: "task/task_rename"
ftrace_events: "exceptions/page_fault_user"
ftrace_events: "filemap/mm_filemap_add_to_page_cache"
ftrace_events: "ftrace/print"
atrace_categories: "am"
atrace_categories: "aidl"
atrace_categories: "dalvik"
atrace_categories: "binder_lock"
atrace_categories: "binder_driver"
atrace_categories: "bionic"
atrace_categories: "pm"
atrace_categories: "wm"
atrace_categories: "res"
atrace_apps: "*"
}
}
}
duration_ms: 60000
```
Contributor guide
Research direction
Start by inspecting tools/record_android_trace at line 624 and reproducing the supplied command with the provided ftrace.config on the Pixel 1 and Pixel 4a. Compare the behavior with the unrooted Pixel 6a and trace where the script blocks. Done means the script prints “Trace started. Press CTRL+C to stop” and accepts Ctrl+C to collect the trace.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android
- Domain
- cli, mobile-dev, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100