Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix two cases of incorrect stack unwinding after panic recovery. #1084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 8, 2021

Conversation

nevkontakte
Copy link
Member

@nevkontakte nevkontakte commented Nov 7, 2021

See commit messages for the detailed information about both bugs and fixes.

…overy.

Using numeric index doesn't work correctly when deferred function have
deferrals inside them along with a blocking call. The test case shows
the exact conditions under which the issue happens and may seem
esoteric, but I've boiled it down from the real code in `net/http`
package.

Fixes gopherjs#1083.
@nevkontakte nevkontakte requested a review from flimzy November 7, 2021 20:56
@nevkontakte nevkontakte enabled auto-merge November 7, 2021 20:56
Runtime throws null when it need to unwind the stack from a point where
`panic` was called to where panic was handled. However, if the panic was
thrown in a deferred function and recovered in the subsequent deferred
function of the same call stack frame, this throw went unhandled
crashing the program.

This change adds a point to handle such throws giving a chance to either
stop unwinding or continue invoking deferred functions if another panic
happened.

Fixes gopherjs#780.
@nevkontakte nevkontakte changed the title Use object identity to detect how far to unwind stack after panic recovery. Fix two cases of incorrect stack unwinding after panic recovery. Nov 8, 2021
@nevkontakte nevkontakte merged commit 55c718a into gopherjs:master Nov 8, 2021
@nevkontakte nevkontakte deleted the double-defer branch November 8, 2021 20:52
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.

Panic recovery + defer inside defer + a blocking call causes incorrect execution resumption. Recover from defered panic causes crash
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.