On Tue, Nov 21, 2023 at 12:25 PM Daniel Stenberg via curl-library <curl-library@lists.haxx.se> wrote: > > On Mon, 13 Nov 2023, Frédéric BOITEUX wrote: > > > My program actually blocks in the socket read. I tried to add some traces, > > but failed : I’ve tried CURL_TRC_CF() and info() tracing functions, but > > I didn’t get traces, probably because there is no more easy handle ever > > available, as my problem comes in curl_multi_cleanup(), after all > > easy_handles have been cleanup… > > curl sets all its sockets in non-blocking state with curlx_nonblock(). Your > case seems to suggest that there are times when it fails to do that. What is > curious is that you are the only one seeing/reporting this. I think this fact > hints that there are additional conditions involved to trigger this. > Conditions we have not figured out yet. > > > #0 __libc_recv (flags=<optimized out>, len=5, buf=0x5639c2314eb3, fd=6) > > at ../sysdeps/unix/sysv/linux/recv.c:28 > > #1 __libc_recv (fd=6, buf=0x5639c2314eb3, len=5, flags=0) > > at ../sysdeps/unix/sysv/linux/recv.c:23 > > #2 0x00005639c2210e12 in nw_in_read () > > If you build libcurl yourself, you could instrument the non-blocking state of > this socket, and maybe just log it just before the recv() call in > nw_in_read().
strace may be a faster way to check if curl tries, and whether its attempt fails to set NOBLOCK. If I'm not mistaken, each socket() (or socketpair()) call should eventually be followed by an fcntl that sets O_NONBLOCK, and that returns = 0 (i.e. is successful). socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP) = 5 fcntl(5, F_GETFL) = 0x2 (flags O_RDWR) fcntl(5, F_SETFL, O_RDWR|O_NONBLOCK) = 0 connect(5,... but I suspect that more debugging may be required anyway. Rainer -- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.html