[PROF-11475] Add extra safety checks when getting line number in profiler #4464
+8
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds a few extra checks when getting the line number during stack trace gathering in the profiler.
We got one automated report of a crash in the
rb_iseq_line_no
function, and we couldn't reproduce it, so this is the first attempt at avoiding the issue -- let's see if we ever observe this crash again or not.Motivation:
Improve stability of the profiler.
Change log entry
None.
Additional Notes:
See the internal PROF-11475 ticket for more details.
How to test the change?
Our existing test coverage already validates that stack trace gathering works fine and matches the Ruby APIs. If this condition was not correct, we'd get more lines set to 0, and our unit tests would fail. (I did some quick manual testing to check this was the case -- and indeed it is).