curl-library
libcurl hangs in curl_multi_cleanup
Date: Wed, 17 Apr 2019 23:44:53 +0200
Hi all
I wrote a simplified program (attached) to demonstrate a problem I'm dealing with.
The problem is that libcurl doesn't allow the program to quit because it hangs inside curl_multi_cleanup:
(gdb) bt
#0 0x00007ffff7e463f1 in poll () from /lib64/libc.so.6
#1 0x00007ffff7f58a46 in poll (__timeout=1000, __nfds=<optimized out>,
__fds=0x7fffffffdc00) at /usr/include/bits/poll2.h:41
#2 Curl_socket_check (readfd0=readfd0_at_entry=3, readfd1=readfd1_at_entry=-1,
writefd=-1, timeout_ms=<optimized out>, timeout_ms_at_entry=1000)
at ../../lib/select.c:217
#3 0x00007ffff7f66347 in Curl_pp_statemach (pp=pp_at_entry=0x422370,
block=block_at_entry=true) at ../../lib/pingpong.c:112
#4 0x00007ffff7f61121 in imap_block_statemach (conn=<optimized out>)
at ../../lib/imap.c:1365
#5 imap_disconnect (conn=0x421cc0, dead_connection=<optimized out>)
at ../../lib/imap.c:1624
#6 0x00007ffff7f3e15d in Curl_disconnect (data=0x4175c0,
conn=conn_at_entry=0x421cc0, dead_connection=dead_connection_at_entry=false)
at ../../lib/url.c:781
#7 0x00007ffff7f6e8f3 in Curl_conncache_close_all_connections (
connc=connc_at_entry=0x409d70) at ../../lib/conncache.c:573
#8 0x00007ffff7f535d1 in curl_multi_cleanup (multi=multi_at_entry=0x409c60)
at ../../lib/multi.c:2244
#9 0x000000000040139a in main (argc=<optimized out>, argv=<optimized out>)
at curl_imap_teardown_issue.c:89
The program logs in to an imaps:// server (using CURLOPT_CONNECT_ONLY), then enters idle mode using curl_easy_send and receives answer using curl_easy_recv. Then sleeps for a few seconds and tries to clean up everything and quit. I followed the order given at https://curl.haxx.se/libcurl/c/curl_multi_cleanup.html but still curl_multi_cleanup() doesn't exit for a long time.
The issue occurs on libcurl-7.61.1 as well as on latest release curl-7.64.1.
Am I doing something wrong, or is it a bug?
--
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
- text/x-c++src attachment: curl_imap_teardown_issue.c