bytedance / bytedance/btrace

生成trace后,在执行stop tracing时脚本无响应

Open
#148 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
335
PR merge metrics
No merged PRs in 30d

Description

你好,我本地在执行脚本后,在执行到stop tracing时,脚本一直没有响应,无法生成最终pb文件,辛苦帮看下什么原因吧。

电脑系统 Mac 13.5 (22G74)

debug 日志如下:
```
cmd: java -jar rhea-trace-processor-2.0.0.jar -a com.app.test -t 10 -o output.pb -r rhea.all sched -fullClassName -debug

04-24 11:26:27.678 D RheaTrace : Run adb devices
04-24 11:26:27.681 D RheaTrace : Got adb path: /usr/local/bin/adb
04-24 11:26:28.267 I RheaTrace : workspace clear: /Users/test/Downloads/rheatrace.workspace
04-24 11:26:28.268 D RheaTrace : Run adb shell setprop persist.traced.enable 1
04-24 11:26:28.829 D RheaTrace : check port free: 8029
04-24 11:26:28.963 D RheaTrace : Run adb shell netstat -tunlp
04-24 11:26:29.622 D RheaTrace : port 8029 is free
04-24 11:26:29.623 D RheaTrace : Run adb shell setprop debug.rhea.httpServerPort 8029
04-24 11:26:30.187 D RheaTrace : Run adb shell setprop debug.rhea.startWhenAppLaunch 1
04-24 11:26:30.790 D RheaTrace : Run adb shell setprop debug.rhea.mainThreadOnly 0
04-24 11:26:31.374 D RheaTrace : Run adb shell setprop debug.rhea.methodIdMaxSize 500000000
04-24 11:26:31.941 D RheaTrace : Run adb shell setprop debug.rhea.category.all 1
04-24 11:26:32.528 D RheaTrace : Run adb shell getprop ro.build.version.sdk
04-24 11:26:33.081 I RheaTrace : os version is 29. default capture is PerfettoCapture
04-24 11:26:33.081 D RheaTrace : system level capture: PerfettoCapture
04-24 11:26:33.098 D RheaTrace : record_android_trace ready: /Users/test/Downloads/rheatrace.workspace/record_android_trace
04-24 11:26:33.098 D RheaTrace : /Users/test/Downloads/rheatrace.workspace/record_android_trace -no_open -a com.app.test -t 11s -o /Users/test/Downloads/rheatrace.workspace/systemTrace.trace sched -b 100mb
04-24 11:26:35.082 D RheaTrace : perfetto starts slowly.
04-24 11:26:35.082 RheaTrace : start tracing...
04-24 11:26:35.082 D RheaTrace : Run adb shell am force-stop com.app.test
04-24 11:26:35.839 D RheaTrace : Run adb shell dumpsys package com.app.test
04-24 11:26:36.453 D RheaTrace : Run adb shell am start -n com.app.test/com.app.test.activity.SplashActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
04-24 11:26:37.104 D RheaTrace : Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.app.test/com.app.test.activity.SplashActivity }
04-24 11:26:46.937 D RheaTrace : I/perfetto( 1069): probes_producer.cc:314 Producer stop (id=3)
04-24 11:26:47.090 D RheaTrace : I/perfetto( 1069): probes_producer.cc:314 Producer stop (id=4)
04-24 11:26:47.108 RheaTrace : stop tracing...
04-24 11:26:47.108 D RheaTrace : Run adb shell am broadcast -a com.bytedance.rheatrace.switch.stop com.app.test
04-24 11:26:47.604 D RheaTrace : I/perfetto(12915): perfetto_cmd.cc:752 Wrote 30484773 bytes into /data/misc/perfetto-traces/2025-04-24_11-26-c40c9d.pftrace
04-24 11:26:47.628 D RheaTrace : I/perfetto( 1068): tracing_service_impl.cc:1661 Tracing session 2 ended, total sessions:0
04-24 11:26:47.751 D RheaTrace : Broadcasting: Intent { act=com.bytedance.rheatrace.switch.stop flg=0x400000 pkg=com.app.test }
04-24 11:26:47.751 D RheaTrace : Broadcast completed: result=0
04-24 11:26:49.266 D RheaTrace : /data/misc/perfetto-traces/2025-04-24_11-26-c40c9d.pftrace: 1 file pulled, 0 skipped. 39.5 MB/s (30484773 bytes in 0.737s)
04-24 11:26:49.882 D RheaTrace :
04-24 11:26:49.883 D RheaTrace :
04-24 11:26:49.883 D RheaTrace : Pulling into /Users/test/Downloads/rheatrace.workspace/systemTrace.trace

// 等待 15 分钟后,一直未生成,断开了连接

04-24 11:42:53.170 D RheaTrace : Run adb forward tcp:8029 tcp:8029
04-24 11:42:54.999 E RheaTrace : Error: adb forward tcp:8029 tcp:8029 return 1.adb: error: no devices/emulators found
04-24 11:42:54.999 E RheaTrace : Tips: have you connect your device via usb.
com.bytedance.rheatrace.processor.core.TraceError: adb forward tcp:8029 tcp:8029 return 1.adb: error: no devices/emulators found
at com.bytedance.rheatrace.processor.Adb.call(Adb.java:145)
at com.bytedance.rheatrace.processor.Adb.call(Adb.java:101)
at com.bytedance.rheatrace.processor.Main.main(Main.java:103)
04-24 11:42:55.162 D RheaTrace : Run adb shell setprop debug.rhea.startWhenAppLaunch 0
04-24 11:42:56.066 D RheaTrace : Run adb shell setprop debug.rhea.mainThreadOnly 0
04-24 11:42:56.789 D RheaTrace : Run adb shell setprop debug.rhea.methodDurThreshold 0
04-24 11:42:57.490 D RheaTrace : Run adb shell setprop debug.rhea.category.all 0
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the command from the issue with the provided debug log, then inspect Main.java:103 and Adb.java:101/145 around the adb forward call. Trace why processing waits after pulling the Perfetto file and how device disconnection is handled. Done means the command completes or reports the failure without hanging.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
cli, devtools, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.