-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
curl_multi_fdset does not return the cpool sockets #15156
Comments
@bagder do you know which version is correct? |
Fixed by #15155 (which used a "fixes" of the wrong issue number) |
I think this was closed in error this was a different issue, I uncovered while working on #15155 |
...
I don't know the answer to this and I haven't found any context in the commit message or PR as to why curl_multi_waitfds was added as an alternative to curl_multi_fdset. The documentation does not cover this. @bagder @dkarpov1970 |
Sorry, I thought it was obvious.
|
I mean, this does not explain the bug here. A bug is a bug. |
I get that, and my concern has nothing to do with it. Users should avoid fdset if they can because of all the issues. However the functions should be consistent aside from the limits that fdset presents. I have included the relevant code below. Relevant code for
Relevant code for
|
Hence me renaming the issue to make it clear what it is about. |
Sorry I misunderstood your response to @jay. It looks like the agreement is that |
I think the more interesting question is curl_multi_waitfds does rather than curl_multi_fdset does not. Why'd he do it that way for connections not in use for a transfer? I could imagine a scenario where a cpool socket is readable and so poll returns immediately, but is curl_multi_perform actually reading that connection for the data if it's not part of a transfer? Then what if it's a busy loop, curl_multi_waitfds -> poll -> curl_multi_perform all return immediately. Could that happen? @icing |
It's a bug. They should extract the exact same set of sockets + actions. |
I assume Dmitry had some good reason for doing it that way because it doesn't look accidental. |
Why should they work differently? |
Oh they shouldn't... I'd still like to hear from him though! |
I wouldn't mind that either, but that doesn't change the fact that they should both return the same sockets in the same states, just different ways. |
Yes but which way, otherwise we could just write a PR and be done with it. I think it deserves some input and as I said earlier I couldn't find any background on it. IMO it makes more sense not to provide cpool sockets to the caller. |
The shutdown connections should be included |
That's a good point, I didn't think of that. Hopefully @icing has some input here. It's unclear to me whether these sockets in the connection pool which are not being operated on will have CURL_WAIT_POLLIN / CURL_WAIT_POLLOUT /set and then are they maintained?, etc, basically I'd think we want to avoid any situation where we accidentally put the app into eating cpu because the socket just always stays at, say CURL_WAIT_POLLIN, because nothing is actually done on it when multi_perform is called but data is available to read (like SSL or HTTP/2 protocol messages arrives etc). I don't know enough about this area to make the determination. |
The difference between *waitfds() and *fdset() is exactly those shutdown connections that should be monitored. Shutdown connections are connections held separately while being closed down "properly". This is crystal clear. |
The reason this is not noticed more by users is probably because curl_multi_fdset() might not be used a lot these days, plus the fact that ignoring the shutdown connections for a while probably can go one without any noticeable impact for a while as well. |
I did this
While implementing #15155 I noticed that these two functions do not return the same set of sockets. Notably
curl_multi_waitfds
can return more thancurl_multi_fdset
.I expected the following
I expected these functions to behave in the same way except one is fd_set based, and the other is poll like.
The difference is both functions return the sockets on the list
multi->process
. However, onlycurl_multi_waitfds
returns the sockets associated withmulti->cpool
.I would expect these functions to operate the same way. I don't know the code base well enough to know which is correct.
curl/libcurl version
8.10.1, master
operating system
Ubuntu 24.04
The text was updated successfully, but these errors were encountered: