curl-library
curl_multi_perform callback busyloop
Date: Wed, 30 Nov 2016 18:31:51 +0300
Hi All.
I'm trying to move from easy to multi interface to be able to listen to
other events while curl transfer is in progress.
I use curl_multi_perform, curl_multi_timeout and curl_multi_fdset in the
main loop and curl_multi_perform in callback that is called when there is
an event on CURL fd.
But I encountered one problem:
curl_multi_timeout returned 1 ms
still_running: 1, sleep for 10 ms
curl_multi_perform: main loop
curl_multi_timeout returned 1 ms
still_running: 1, sleep for 10 ms
curl_multi_perform: main loop
curl_multi_timeout returned 200 ms
still_running: 1, sleep for 100 ms
fd 5: read=0, write=1, exception=0, curlm=0xf566f0
curl_cb: curl_multi_perform: callback, curlm=0xf566f0
curl_multi_perform: main loop
curl_multi_timeout returned 99 ms
still_running: 1, sleep for 100 ms
fd 5: read=0, write=1, exception=0, curlm=0xf566f0
curl_cb: curl_multi_perform: callback, curlm=0xf566f0
curl_cb: curl_multi_perform: callback, curlm=0xf566f0
curl_cb: curl_multi_perform: callback, curlm=0xf566f0
curl_cb: curl_multi_perform: callback, curlm=0xf566f0
curl_cb: curl_multi_perform: callback, curlm=0xf566f0
curl_cb: curl_multi_perform: callback, curlm=0xf566f0
*... about !! 350 !! OF THE SAME CALLS*
curl_cb: curl_multi_perform: callback, curlm=0xf566f0
curl_multi_perform: main loop
curl_multi_timeout returned 119778 ms
still_running: 1, sleep for 100 ms
fd 5: read=1, write=0, exception=0, curlm=0xf566f0
curl_cb: curl_multi_perform: callback, curlm=0xf566f0
curl_multi_perform: main loop
curl_multi_timeout returned 119678 ms
still_running: 1, sleep for 100 ms
fd 5: read=1, write=0, exception=0, curlm=0xf566f0
curl_cb: curl_multi_perform: callback, curlm=0xf566f0
curl_cb: curl_multi_perform: callback, curlm=0xf566f0
qh_curl_multi_perform: main loop
still_running: 0
I just need to transfer about 200-300 bytes, so I do not understand why
there are so many callback events. It looks like curl_multi_perform
sometimes do nothing there and as a result I have a busy loop.
Could somebody explain what is happening under the hood and how to avoid
such a busy loop?
Thanks,
Sergey.
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-11-30