Skip to content

connection limits not respected after call to curl_easy_reset #17052

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

Closed
epicmkirzinger opened this issue Apr 14, 2025 · 2 comments
Closed

connection limits not respected after call to curl_easy_reset #17052

epicmkirzinger opened this issue Apr 14, 2025 · 2 comments
Assignees

Comments

@epicmkirzinger
Copy link

epicmkirzinger commented Apr 14, 2025

I did this

After performing an upgrade of curl, I noticed WSAEADDRINUSE errors started occurring in a program that makes requests to many servers and reuses easy handles, calling curl_easy_reset in between. It seemed like the connection limits were not being respected.

Performing a git-bisect revealed that the problem was introduced in 22d292b

Upon inspecting the change, I observed the following: dohfor_mid is initialized to -1 in Curl_open, however when curl_easy_reset is called, it ends up as 0 when the UserDefined struct in the Curl_easy is memset to 0. Once it is 0, the (data->set.dohfor_mid >= 0) condition in create_conn then becomes true, resulting in the connection limit being overridden. Changing it so that dohfor_mid is instead initialized to -1 in Curl_init_userdefined has resolved the issue for me.

I expected the following

No response

curl/libcurl version

>= curl-8.10.0

operating system

Windows 10

@icing icing self-assigned this Apr 15, 2025
icing added a commit to icing/curl that referenced this issue Apr 15, 2025
On an easy reset, the dohfor_mid must be reset to -1.

refs curl#17052
@icing
Copy link
Contributor

icing commented Apr 15, 2025

Thanks for your report! Your analysis is correct. I made #17058 with the fix as you suggested. Care to verify?

@epicmkirzinger
Copy link
Author

I can verify that change resolves the issue.

@bagder bagder closed this as completed in 39326f8 Apr 15, 2025
nbaws pushed a commit to nbaws/curl that referenced this issue Apr 26, 2025
On an easy reset, the dohfor_mid must be reset to -1.

Reported-by: epicmkirzinger on github
Fixes curl#17052
Closes curl#17058
nbaws pushed a commit to nbaws/curl that referenced this issue Apr 26, 2025
On an easy reset, the dohfor_mid must be reset to -1.

Reported-by: epicmkirzinger on github
Fixes curl#17052
Closes curl#17058
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants