janestreet / memtrace

Streaming client for OCaml's Memprof
MIT License
65 stars 13 forks source link

Exception while reading a trace #18

Open dwwoelfel opened 2 years ago

dwwoelfel commented 2 years ago

When I trace my program for a few minutes, Memtrace loses the ability to read back the file without an exception.

Given a trace, the following code will throw an exception:

let trace =
  Memtrace.Trace.Reader.open_
    ~filename:"trace.ctf"
Memtrace.Trace.Reader.iter trace (fun _ _  -> ())
Uncaught exception:

  "Assert_failure src/location_codec.ml:27:17"

Raised at Memtrace__Location_codec.Mtf_table.swap in file "src/location_codec.ml", line 27, characters 17-29
Called from Memtrace__Location_codec.Mtf_table.decode in file "src/location_codec.ml", line 59, characters 6-16
Called from Memtrace__Location_codec.Reader.get_location.(fun) in file "src/location_codec.ml", line 177, characters 8-143
Called from Stdlib__list.init_aux in file "list.ml", line 69, characters 12-15
Called from Memtrace__Location_codec.Reader.get_location in file "src/location_codec.ml", line 150, characters 15-1534
Called from Memtrace__Trace.iter.iter_events_of_packet in file "src/trace.ml", line 693, characters 24-71
Called from Memtrace__Trace.iter.iter_packets in file "src/trace.ml", line 737, characters 8-50
Called from Onegraph in file "src/onegraph.re", line 31, characters 0-127

I'd be happy to provide my trace file if there is a janestreet dev that wants to look into it.

stedolan commented 2 years ago

Happy to take a look! Is the trace file particularly large?

tmcgilchrist commented 1 week ago

Duplicate of https://github.com/janestreet/memtrace_viewer/issues/14 which is fixed by #23