Fix SystemStackError caused by infinite recursion in _handle_result#13
Open
Fix SystemStackError caused by infinite recursion in _handle_result#13
Conversation
1446870 to
d781162
Compare
a2f513c to
c7c8129
Compare
Danger ReportNo issues found. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
+ Coverage 97.41% 97.47% +0.06%
==========================================
Files 29 30 +1
Lines 696 713 +17
==========================================
+ Hits 678 695 +17
Misses 18 18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
87f5b1c to
b5ba128
Compare
When an error occurred during result handling (e.g., a logging error), the rescue block in _handle_result would recursively call itself, leading to infinite recursion and SystemStackError. This fix prevents recursion by directly invoking the error callbacks instead of calling _handle_result again. The logger.error call is also wrapped with rescue nil to prevent logging errors from propagating. Fixes #12 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
b5ba128 to
849be69
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #12 - SystemStackError when using local theme
Problem
When an error occurred during result handling (e.g., a logging error in Jekyll's Stevenson logger), the rescue block in
_handle_resultwould recursively call itself, leading to infinite recursion andSystemStackError.Solution
This fix prevents recursion by directly invoking the error callbacks (
result!anderror!) instead of calling_handle_resultagain. Thelogger.errorcall is also wrapped withrescue nilto prevent logging errors from propagating.Changes
lib/ruby-link-checker/tasks.rbto handle errors without recursionspec/ruby-link-checker/tasks_spec.rbwith a test that verifies the fix