Skip to content

Conversation

@aidenfoxivey
Copy link
Contributor

When using stackprof on a large trace (approximately 3.5 GiB), I noted that stackprof fails.

/opt/homebrew/lib/ruby/gems/3.4.0/gems/stackprof-0.2.27/lib/stackprof/report.rb:13:in 'IO.binread': Invalid argument @ io_fread - /Users/aidenfoxivey/src/ruby-bench/benchmarks/lobsters/zjit_exit_locations.dump (Errno::EINVAL)
        from /opt/homebrew/lib/ruby/gems/3.4.0/gems/stackprof-0.2.27/lib/stackprof/report.rb:13:in 'StackProf::Report.from_file'
        from ./bin/stackprof:78:in '<main>'

This is because IO.binread can only read a max size of 2 GiB (the number of bytes there being equivalent to the max size of a signed 32-bit integer).

Since checking the first two bytes should not require reading the whole file, this patch only reads the first two, rewinds, and then (if matching the MARSHAL_SIGNATURE) uses Marshal.load, which does allow reads over 2 GiB.

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 this pull request may close these issues.

ZJIT: stackprof can't read large exit location dumps

2 participants