curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

CLOSESOCKETFUNCTION not always called in multi

From: Malcolm Matalka via curl-library <curl-library_at_lists.haxx.se>
Date: Sun, 26 Jan 2025 23:42:22 +0100

Hello, I'm debugging a bug in my program using the multi interface. I'm still trying to work out some details but I thought maybe someone who knows the codebase better than I might just see it as obvious.

In my case, I am setting SOCKETFUNCTION, TIMERFUNCTION, and CLOSESOCKETFUNCTION because I need to manage the sockets myself (I'm integrating curl against a concurrency library in Ocaml). Because of how the concurrency library works, instead of doing any work in those callbacks functions, I'm adding the event to a queue then processing the events after a "perform" or "action" call.

What I'm seeing is that I have a POLL_REMOVE call for a socket, but then my CLOSESOCKETFUNCTION callback is not being called. I can see in the ktrace logs that the socket is directly being closed with "close".

I *think* this is happening due libcurl deciding the connection has timed out and some logic chooses not to execute the close callback. But I'm not entirely sure.

Any idea how I can turn on the tracing for cf-socket.c? I have set the global trace to 'all' but I am not seeing the logs I am looking for?

I am on FreeBSD use curl 8.11.1.

Thank you

/Malcolm
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2025-01-26