curl-users
Re: curl is wasting CPU time when libssh2 returns LIBSSH2_ERROR_EAGAIN
Date: Fri, 26 Sep 2008 10:57:12 +0200 (CEST)
On Thu, 25 Sep 2008, Vlad Grachov wrote:
> recv() that returns -1
> libssh2_packet_read
> libssh2_channel_read_ex
> libssh2_sftp_packet_read
> libssh2_sftp_packet_requirev
> libssh2_sftp_readdir_ex that returns LIBSSH2_ERROR_EAGAIN
> ssh_statemach_act that returns CURLE_OK
> ssh_easy_statemach
> sftp_perform
> ssh_do
> Curl_do
> Curl_perform
> curl_easy_perform
Ah yes, now that you mention it that's code I've been noticing myself as in
need to get fixed. It needs to do select/poll in there to be nice and
friendly!
> I'll try to make a small patch to libssh2 + libcurl.
For this particular problem a first shot could leave out the libssh2 fix we
talked about and "just" make sure libcurl waits on sockets before it acts on
them. libcurl does that when it does SSH-based protocols using the multi
interface. This "shortcut" in the code is just used when the easy interface is
used.
> However as I am a neither libcurl or libssh2 experienced developer my patch
> can be just a draft pattern for someone's final one.
It'll still be much appreciated and offer us something to continue working
from!
> To see 100% CPU usage you can use my small tunneling software that stops
> transmitting after it receives a certain amount of bytes:
> http://fmot.ru/tcp_forward.cpp
Thanks!
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users FAQ: http://curl.haxx.se/docs/faq.html Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2008-09-26