perfetto icon indicating copy to clipboard operation
perfetto copied to clipboard

Failed to open trace file with trace_processor_shell on Mac(M1 Pro)

Open jinwencan opened this issue 1 year ago • 6 comments

I have download trace_processor_shell from [https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v49.0/mac-arm64/trace_processor_shell], but when i run 'trace_processor_shell --httpd filePath',i got error like [721.298] d_trace_internal.cc:100 Cannot use mmap on this system. Falling back on read() Could not read trace file (path: /xxx/skia/skia/platform_tools/android/apps/skottie/out/trace_lottie_hw_0_star): Could not open trace file (path: /xxx/skia/platform_tools/android/apps/skottie/out/trace_lottie_hw_0_star), I am sure that the file is exist and is readable.Can anyone help ,I will be very thankful

jinwencan avatar Mar 14 '25 09:03 jinwencan

The error "Could not open trace file" happens due to one of the following cases:

  • The trace does not exist at the path
  • The user the trace processor is running as does not have permissions to access the trace (for example, if the file is owned by root but you are running as your own user)
  • The trace is corrupt.

The mmap error is harmless and is a red herring, the second error is all that matters.

Likely it's some ACL-related permission. Maybe you are generating a trace running some tool as root, and then are trying to pass it to Trace Processor and it fails to open it. Try chmod-ing it (chmod 644 /xxx/skia/platform_tools/android/apps/skottie/out/trace_lottie_hw_0_star)

aMayzner avatar Mar 14 '25 10:03 aMayzner

The error "Could not open trace file" happens due to one of the following cases:

  • The trace does not exist at the path
  • The user the trace processor is running as does not have permissions to access the trace (for example, if the file is owned by root but you are running as your own user)
  • The trace is corrupt.

The mmap error is harmless and is a red herring, the second error is all that matters.

Likely it's some ACL-related permission. Maybe you are generating a trace running some tool as root, and then are trying to pass it to Trace Processor and it fails to open it. Try chmod-ing it (chmod 644 /xxx/skia/platform_tools/android/apps/skottie/out/trace_lottie_hw_0_star)

@aMayzner Thanks for reply, but I am sure the trace file is exist and readable.

Image Is there something i missed?

jinwencan avatar Mar 17 '25 03:03 jinwencan

Can you please check if running shell without httpd flag works?

aMayzner avatar Mar 17 '25 16:03 aMayzner

Can you please check if running shell without httpd flag works?

@aMayzner The situation is the same.

Image

jinwencan avatar Mar 18 '25 03:03 jinwencan

So this is a super super mysterious error from our perspective. The code to open/read files is trivially simple. It's just an open + read. On your machine for whatever reason, even the open is failing (that's what the error message is saying).

I wonder if macOS is blocking us from accessing the file. Can you go to system settings on macOS and verify that your terminal/trace_processor_shell have access to the file? My theory is that macOS has some toggle preventing acceess.

FWIW I cannot repro this on my M1 macOS machine which is why I'm struggling to figure out how to help.

LalitMaganti avatar Mar 18 '25 09:03 LalitMaganti

Without a repro or more info, it's impossible to do anything more here.

LalitMaganti avatar Jun 03 '25 20:06 LalitMaganti