Search code examples
androidperformancedebuggingadbsystrace

systrace error: Bad file descriptor (9)


Short description: Actually sometimes tracing with systrace working, but only if I doesn't do anything with my application. If i try to do some normal user actions, trace saving process will end up with error.

Error message: Unexpected error while collecting system trace. Unable to find trace start marker 'TRACE:': capturing trace...error writing to /sys/kernel/debug/tracing/trace_marker: Bad file descriptor (9)

Screenshot: here the error window itself

As you can see, i'am using systrase with Android Device Monitor, maybe this is the problem.

if you use systrace with cmd, it needs python to work. So i've tried python both 2.7 and 3.6 versions, and none of them worked.

Traces are stored in the main User directory as ADM wanted by default.

I've searched whole internet to solve this problem, but didn't find anything, please help.


Solution

  • I found the solution. You simply need to give the systrace a larger amount of memory before execute tracing. So, in "Trace Buffer Size (kb)" write more than default 2048, and error must disappear. I'm personally using 16000 kb.