Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracing fails to start on Xiaomi 12 #1077

Closed
bylaws opened this issue Apr 7, 2022 · 7 comments · Fixed by #1082
Closed

Tracing fails to start on Xiaomi 12 #1077

bylaws opened this issue Apr 7, 2022 · 7 comments · Fixed by #1082

Comments

@bylaws
Copy link

bylaws commented Apr 7, 2022

Environment information:

  • AGI version: 2022-3.0.0
  • Host OS: Windows
  • Device model: Xiaomi 12 Global
  • Android Version: A12, latest available

Bug description
Attempting to system trace any debuggable app, even the builtin agi sample fails.

Reproduction steps
Attempt to trace any app, it will fail

Stacktrace

com.google.gapid.server.Client$InternalServerErrorException: Tracing Failed
   Cause: Could not start trace
   Cause: Cannot trace non-debuggable app
   Cause: Device is not a userdebug build

	at com.google.gapid.server.Client.throwIfError(Client.java:327)

	at com.google.gapid.server.Client.lambda$streamTrace$58(Client.java:301)

	at com.google.gapid.server.GapidClientGrpc$StreamHandler.onNext(GapidClientGrpc.java:232)

	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onMessage(ClientCalls.java:465)

	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:656)

	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:641)

	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)

	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)

	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

	at java.base/java.lang.Thread.run(Unknown Source)

Caused by: com.google.gapid.server.Client$Stack: For request: RPC->streamTrace()

	at com.google.gapid.server.Client.streamTrace(Client.java:298)

	at com.google.gapid.server.Tracer.trace(Tracer.java:41)

	at com.google.gapid.views.TracerDialog.showTracingDialog(TracerDialog.java:197)

	at com.google.gapid.views.TracerDialog.showSystemTracingDialog(TracerDialog.java:175)

	at com.google.gapid.LoadingScreen.lambda$new$0(LoadingScreen.java:117)

	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)

	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4237)

	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1060)

	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)

	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3626)

	at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)

	at org.eclipse.jface.window.Window.open(Window.java:799)

	at com.google.gapid.Main$UI.show(Main.java:140)

	at com.google.gapid.Main.main(Main.java:80)

Screenshots
image

Additional debugging information
gapic.log
gapis.log
logcat-full.txt

@pmuetschard
Copy link
Member

AGI uses adb shell dumpsys package to determine what packages are installed on the system and determines whether they are debuggable based on the output: we expect a flags field containing DEBUGGABLE.

Could you please provide the output of adb shell dumpsys package com.google.android.gapid.arm64v8a?

@bylaws
Copy link
Author

bylaws commented Apr 12, 2022

log.txt
@pmuetschard

@bylaws
Copy link
Author

bylaws commented Apr 12, 2022

log.txt @pmuetschard

I should add that validation definitely succeeded and I could see trace and counter stuff being recorded in logcat at the time.

@pmuetschard
Copy link
Member

Strange, I ran the provided output through the parser and it correctly identified the package as debuggable, so it appears as though everything is working properly. Would you be willing to provide me the entire output of adb shell dumpsys package? maybe there something else in there that is putting the parser into a bad state, not replicated by limiting it to one package. You can upload it to Google Drive/email it me directly if you don't want the entire thing to be public.

I should add that validation definitely succeeded and I could see trace and counter stuff being recorded in logcat at the time.

Yes, I saw that from the logs. It looks like tracing works just fine. However, when it goes through the trace-user-app flow, AGI thinks the app is not debuggable and tries to run adb root, which fails, failing tracing. (see https://github.com/google/agi/blob/v3.0.0/gapis/trace/android/trace.go#L710)

@bylaws
Copy link
Author

bylaws commented Apr 13, 2022

(I sent you an email)

pmuetschard added a commit to pmuetschard/agi that referenced this issue Apr 14, 2022
Some devices produce malformed dumpsys package output, adding in extra
newlines. This change handles a specific version of how this extra
whitespace breaks the parser.

Fixes google#1077
pmuetschard added a commit to pmuetschard/agi that referenced this issue Apr 20, 2022
Some devices produce malformed dumpsys package output, adding in extra
newlines. This change handles a specific version of how this extra
whitespace breaks the parser.

Fixes google#1077
pmuetschard added a commit that referenced this issue Apr 20, 2022
Some devices produce malformed dumpsys package output, adding in extra
newlines. This change handles a specific version of how this extra
whitespace breaks the parser.

Fixes #1077
pmuetschard added a commit to pmuetschard/agi that referenced this issue Apr 20, 2022
Some devices produce malformed dumpsys package output, adding in extra
newlines. This change handles a specific version of how this extra
whitespace breaks the parser.

Fixes google#1077
pmuetschard added a commit that referenced this issue Apr 20, 2022
Some devices produce malformed dumpsys package output, adding in extra
newlines. This change handles a specific version of how this extra
whitespace breaks the parser.

Fixes #1077
@bylaws
Copy link
Author

bylaws commented Apr 22, 2022

Is there some way to download builds from CI with this or will I need to compile myself

rosasco-wk pushed a commit to rosasco-wk/agi that referenced this issue Apr 25, 2022
Some devices produce malformed dumpsys package output, adding in extra
newlines. This change handles a specific version of how this extra
whitespace breaks the parser.

Fixes google#1077
@pmuetschard
Copy link
Member

The just released 3.0.1 release contains the fix for this.

kocdemir pushed a commit to kocdemir/agi that referenced this issue May 5, 2022
Some devices produce malformed dumpsys package output, adding in extra
newlines. This change handles a specific version of how this extra
whitespace breaks the parser.

Fixes google#1077

ignore .DS_Store also from the subfolders;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants