Repository navigation
Propagate callback panics from Multi::perform, action and timeout - #695
Open
thelastbackspace wants to merge 1 commit into
Open
thelastbackspace wants to merge 1 commit into
thelastbackspace wants to merge 1 commit into
Conversation
A panic caught in a callback during a Multi transfer was stored in the thread-local slot but never resumed, so it stayed there and blew up the next unrelated Easy::perform on the same thread (and blocked all callbacks until then). Call panic::propagate() after curl_multi_perform and curl_multi_socket_action like Easy::perform does. Fixes sagebind#694
This branch has not been deployed
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.
Fixes #694
When a callback panics during a
Multitransfer,panic::catchstores the payload in the thread-localLAST_ERROR, but none of theMultimethods ever callpanic::propagate(). So the transfer just fails with a write error, the panic stays in the slot, every callback on that thread gets skipped from then on, and the old panic finally comes out of the next unrelatedEasy::perform.This adds
panic::propagate()aftercurl_multi_performandcurl_multi_socket_action(perform,action,timeout), the same wayEasy::performdoes it. It runs before the error is returned, so the panic is raised even when libcurl also reports an error.I added
panic_in_callback_is_propagatedtotests/multi.rs. It panics in a header callback during a multi transfer, checks that the panic comes out ofperform, then runs a plainEasytransfer on the same thread to make sure nothing was left behind. Without the fix the multi loop finishes quietly and the leftover panic shows up in theEasy::performcall.