curl / Mailing Lists / curl-library / Single Mail


Re: curl_multi: SOCKETFUNCTION is called to POLL_REMOVE after socket was already closed

From: Daniel Stenberg via curl-library <>
Date: Thu, 21 Feb 2019 16:45:39 +0100 (CET)

On Thu, 21 Feb 2019, Pavel Löbl via curl-library wrote:

> I've noticed that SOCKETFUNCTION is called to POLL_REMOVE the socket from
> watched set after the socket was already closed by curl internally.

It does not reproduce for me. I get "epoll_ctl(ADD): File exists" (and then it
exits) because it doesn't seem to update an existing handle, just try to add a
new one already that one is already present.

But I don't think I need to, your description below is excellent:

> I think I've identified the code path. It all starts in
> Curl_disconnect. At first Curl_conncache_remove_conn unlinks easy
> handle from connectdata structure then conn_free is called. conn_free
> calls Curl_closesocket which calls Curl_multi_closed. However
> Curl_multi_closed expects there is still easy handle associated so it
> does nothing (not calling SOCKETFUNCTION).

I think you're spot on. My recent work in properly separating the connections
from transfers caused this regression. I'll get to work and see how I can fix



Received on 2019-02-21