Skip to content

[HttpClient] fix monitoring responses issued before reset() #44625

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 1 commit into from
Dec 14, 2021

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Dec 14, 2021

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

Follow up of #44601

In order to reset the DNS cache, we have to create a new curl-multi handle. But since there might still be responses attached to the previous handle, we need to keep it around to monitor it.

Best reviewed ignoring whitespaces.

@@ -325,7 +335,7 @@ private static function select(ClientState $multi, float $timeout): int
$timeout = min($timeout, 0.01);
}

return curl_multi_select($multi->handle, $timeout);
return curl_multi_select($multi->handle[array_key_last($multi->handle)], $timeout);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the last key rather than the first one ?

Copy link
Member Author

@nicolas-grekas nicolas-grekas Dec 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the last handle is one for which we're sure there is pending activity (since handles past the 0 one are all removed when they're empty).

@nicolas-grekas nicolas-grekas force-pushed the hc-oldhandles branch 4 times, most recently from 16fe114 to 7506401 Compare December 14, 2021 17:48
@nicolas-grekas nicolas-grekas merged commit 068674b into symfony:4.4 Dec 14, 2021
@nicolas-grekas nicolas-grekas deleted the hc-oldhandles branch December 15, 2021 14:00
nicolas-grekas added a commit to nicolas-grekas/symfony that referenced this pull request Jan 13, 2022
This PR reverts symfony#44625 and uses a new curl-share handle instead to reset
any state.
nicolas-grekas added a commit to nicolas-grekas/symfony that referenced this pull request Jan 13, 2022
This PR reverts symfony#44625 and uses a new curl-share handle instead to reset
any state.
nicolas-grekas added a commit to nicolas-grekas/symfony that referenced this pull request Jan 13, 2022
This PR reverts symfony#44625 and uses a new curl-share handle instead to reset
any state.
nicolas-grekas added a commit that referenced this pull request Jan 14, 2022
…ient::reset() (nicolas-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] fix resetting DNS/etc when calling CurlHttpClient::reset()

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #44900
| License       | MIT
| Doc PR        | -

This PR reverts #44625 and uses a new curl-share handle instead to reset any state.

Commits
-------

d426646 [HttpClient] fix resetting DNS/etc when calling CurlHttpClient::reset()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants