janestreet / janestreet/magic-trace

"Unexpected event type when parsing perf output" with sampling mode

Open
#311 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
OCaml
Stars
6.3k
Forks
209
PR merge metrics
No merged PRs in 30d

Description

VM tracing seems broken at least in some circumstances on newer perfs.

$ magic-trace attach -p 647317
Intel PT support not found. magic-trace will continue and use sampling instead.
Warning: [-callgraph-mode] is defaulting to [Dwarf] which may have high overhead and decoding time. For more info: https://magic-trace.org/w/b
[ Attached. Press Ctrl-C to stop recording. ]
^C[ Got signal, detaching... ]
[ Snapshot taken. ]
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.570 MB /tmp/magic_trace.tmp.5d6b24/perf.data (82 samples) ]
[ Finished recording. ]
[ Decoding, this takes a while... ]
(monitor.ml.Error
 ("BUG: exception raised while parsing perf output. Please report this to https://github.com/janestreet/magic-trace/issues/"
  (exn
   ("Unexpected event type when parsing perf output" (event_name cpu-clock)))
  (perf_output
   ("647317/647317 529215.810279538:     100000 cpu-clock:uH: "
    "\t         687bd57 check_action_pending+0x7 (redacted)"
    "\t         684ddfd caml_thread_restore_runtime_state+0x151 (redacted)"
    "\t         684de81 caml_thread_leave_blocking_section+0xd (redacted)")))
 ("Raised at Base__Error.raise in file \"src/error.ml\" (inlined), line 9, characters 14-30"
  "Called from Base__Error.raise_s in file \"src/error.ml\", line 10, characters 19-40"
  "Called from Async_kernel__Pipe.map.(fun) in file \"src/pipe.ml\", line 1066, characters 65-70"
  "Called from Async_kernel__Job_queue.run_jobs in file \"src/job_queue.ml\", line 180, characters 6-47"
  "Caught by monitor Monitor.protect"))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with magic-trace attach -p 647317 when Intel PT falls back to sampling, then trace the perf-output parsing path for the reported cpu-clock event. Use the attached perf output and stack trace as the starting evidence; done means sampling captures decode successfully without the unexpected-event error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
observability, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.