Skip to content

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