bytedance / btrace

🔥🔥 btrace(AKA RheaTrace) is a high performance Android trace tool which is based on Perfetto, it support to define custom events automatically during building apk and using bhook to provider more native events like Render/Binder/IO etc.
Other
1.86k stars 264 forks source link

执行的时候报异常,无法正常抓取 #128

Open JerryNingZhen opened 2 months ago

JerryNingZhen commented 2 months ago

Exception in thread "main" java.net.SocketException: Unexpected end of file from server at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:862) at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:689) at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:859) at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:689) at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1615) at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520) at java.base/java.net.URL.openStream(URL.java:1165) at org.apache.commons.io.IOUtils.toString(IOUtils.java:2953) at com.bytedance.rheatrace.processor.Adb$Http.get(Adb.java:164) at com.bytedance.rheatrace.processor.core.Mapping.selectMapping(Mapping.java:47) at com.bytedance.rheatrace.processor.core.Mapping.loadMapping(Mapping.java:79) at com.bytedance.rheatrace.processor.core.Mapping.get(Mapping.java:36) at com.bytedance.rheatrace.processor.core.AppTraceProcessor.processBinary(AppTraceProcessor.java:145) at com.bytedance.rheatrace.processor.core.AppTraceProcessor.getBinaryTrace(AppTraceProcessor.java:50) at com.bytedance.rheatrace.processor.lite.LiteCapture.process(LiteCapture.java:73) at com.bytedance.rheatrace.processor.Main.main(Main.java:108)

JerryNingZhen commented 2 months ago

Android 端日志 2024-05-02 15:52:57.610 6825-6825/ D/Rhea.ATrace.JNI: JNI_OnLoad 2024-05-02 15:52:57.614 6825-6825/ D/Rhea:TraceSwitch: start tracing when launch app. 2024-05-02 15:52:57.641 6825-6825/ I/RheaServer: start new http server on port 8093 2024-05-02 15:52:57.682 6825-6825/ E/Rhea.ATrace.JNI: main thread id 6825 2024-05-02 15:52:57.682 6825-6825/ E/Rhea.Logger: buffer size 500000 2024-05-02 15:52:57.713 6825-6866/D/Rhea.Logger: start async atrace writer thread 2024-05-02 15:52:57.713 6825-6866/ W/Rhea: trace file is: /storage/emulated/0/Android/data/xxxx/files/rhea-trace/rhea-atrace.gz 2024-05-02 15:52:57.714 6825-6866/ E/Rhea.NativeTraceCallback: OnTraceStart: trace_id=18316, flags=2, trace_file=/storage/emulated/0/Android/data/xxxfiles/rhea-trace/rhea-atrace.gz 2024-05-02 15:52:57.717 6825-6825/ E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.732 6825-6825/ E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.745 6825-6825/I/Rhea.hookbridge: start rhea category io 2024-05-02 15:52:57.750 6825-6825 E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.854 6825-6825/E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.865 6825-6825/ I/Rhea.hookbridge: start rhea category class 2024-05-02 15:52:57.866 6825-6825/xxx I/Rhea.hookbridge: start rhea category thread 2024-05-02 15:52:57.890 6825-6825/xxx I/Rhea.hookbridge: start rhea category binder 2024-05-02 15:52:57.893 6825-6825/xxx E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.923 6825-6825/xxx E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.933 6825-6825/xxx I/Rhea.hookbridge: start rhea category render 2024-05-02 15:52:58.126 6825-6825/xxx D/Rhea.ATrace: start trace cost us: 444624 2024-05-02 15:53:08.736 6825-6825/xxx D/Rhea.ATrace: log atrace cost us: 0 2024-05-02 15:53:08.736 6825-6825/xxx D/Rhea.ATrace: stop trace cost us: 116 2024-05-02 15:53:08.755 6825-6866/xxx E/Rhea.NativeTraceCallback: OnTraceEnd: trace_id=18316 2024-05-02 15:53:08.755 6825-6866/xxx D/Rhea.Logger: Stop async atrace writer thread

JerryNingZhen commented 2 months ago

Android 端日志 2024-05-02 15:52:57.610 6825-6825/ D/Rhea.ATrace.JNI: JNI_OnLoad 2024-05-02 15:52:57.614 6825-6825/ D/Rhea:TraceSwitch: start tracing when launch app. 2024-05-02 15:52:57.641 6825-6825/ I/RheaServer: start new http server on port 8093 2024-05-02 15:52:57.682 6825-6825/ E/Rhea.ATrace.JNI: main thread id 6825 2024-05-02 15:52:57.682 6825-6825/ E/Rhea.Logger: buffer size 500000 2024-05-02 15:52:57.713 6825-6866/D/Rhea.Logger: start async atrace writer thread 2024-05-02 15:52:57.713 6825-6866/ W/Rhea: trace file is: /storage/emulated/0/Android/data/xxxx/files/rhea-trace/rhea-atrace.gz 2024-05-02 15:52:57.714 6825-6866/ E/Rhea.NativeTraceCallback: OnTraceStart: trace_id=18316, flags=2, trace_file=/storage/emulated/0/Android/data/xxxfiles/rhea-trace/rhea-atrace.gz 2024-05-02 15:52:57.717 6825-6825/ E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.732 6825-6825/ E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.745 6825-6825/I/Rhea.hookbridge: start rhea category io 2024-05-02 15:52:57.750 6825-6825 E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.854 6825-6825/E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.865 6825-6825/ I/Rhea.hookbridge: start rhea category class 2024-05-02 15:52:57.866 6825-6825/xxx I/Rhea.hookbridge: start rhea category thread 2024-05-02 15:52:57.890 6825-6825/xxx I/Rhea.hookbridge: start rhea category binder 2024-05-02 15:52:57.893 6825-6825/xxx E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.923 6825-6825/xxx E/Rhea.hookbridge: don't hook lib librhea-trace.so 2024-05-02 15:52:57.933 6825-6825/xxx I/Rhea.hookbridge: start rhea category render 2024-05-02 15:52:58.126 6825-6825/xxx D/Rhea.ATrace: start trace cost us: 444624 2024-05-02 15:53:08.736 6825-6825/xxx D/Rhea.ATrace: log atrace cost us: 0 2024-05-02 15:53:08.736 6825-6825/xxx D/Rhea.ATrace: stop trace cost us: 116 2024-05-02 15:53:08.755 6825-6866/xxx E/Rhea.NativeTraceCallback: OnTraceEnd: trace_id=18316 2024-05-02 15:53:08.755 6825-6866/xxx D/Rhea.Logger: Stop async atrace writer thread

WangFeng-AHU commented 1 month ago

需要加上 -m path/to/rhea/methodMapping.txt 来指定 methodMapping 文件路径