Repository navigation
Release HttpClient on its loop after a DNS lookup - #2667
Open
StevSoested wants to merge 1 commit into
Open
StevSoested wants to merge 1 commit into
StevSoested wants to merge 1 commit into
Conversation
…n its loop after a DNS lookup Updated lambda function to use mutable capture for 'thisPtr' and added comments for clarity.
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 #2666.
The callback given to the resolver holds a
shared_ptrto the client.NormalResolvercalls it on a thread of its ownand destroys it there, so that copy can be the client's last reference;
~HttpClientImpl()then runs on the resolver'sthread and uses the client's loop, which may be gone (heap corruption, SIGSEGV). This moves the reference into the work
handed to the loop, so the client is always let go of on its loop. Behaviour is otherwise unchanged: the client still
lives through the lookup, as before.
Tested:
HttpClient, 300 runs each under the same load: 13 crashes before, 0 after.ctest, 40 tests) pass. The integration test was not run here, as it listens on ports 80 and 443,which the test machine uses.