cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Timeout problem using libcurl 7.19.3 to send file from windows

From: Peppicelli, Daniel <daniel.peppicelli_at_kollmorgen.com>
Date: Mon, 30 May 2011 14:28:48 +0200

Hi Daniel,

Thanks for the quick answer, and sorry if I was not clear enough.

Let me clarify:

- Unfortunately, we are using this old version because we have a product
running on several platform (windows, Windows Intime Kernel and QNX).
libcurl is embedded in the latest version of QNX. Unfortunately, the
folks at QNX did not use the latest version but rather the 7.19.3. I'll
ask them for a new version or I'll compile it myself just to try.

- You're right, I did meant that we can not do multiple files within the
same multipart formpost request, we have to make N requests in order to
transfer N files.

- I'm saying that it takes ~2.5 [s] to transfer a file of < 10k. Inside
these two seconds, we "lose" 2 seconds inside the select() call in
Curl_socket_ready() function. Those two seconds comes for two timeouts
by the select() call

 I did figure it out with this modified version of Curl_socket_ready()
in select.c:

#else /* HAVE_POLL_FINE */

[.......]

  do {
    if(timeout_ms > 0) {
      pending_tv.tv_sec = pending_ms / 1000;
      pending_tv.tv_usec = (pending_ms % 1000) * 1000;
    }
    else if(!timeout_ms) {
      pending_tv.tv_sec = 0;
      pending_tv.tv_usec = 0;
    }

        start = clock();
        r = select((int)maxfd + 1, &fds_read, &fds_write, &fds_err,
ptimeout);
        finish = clock();
        if ((double)(finish - start) > 50.0)
        {
                OutputDebugString( "Blocked time in select
[ms]:\t\t\t\t");
                sprintf(tmpbuf,"%f",(double)(finish-start));
                OutputDebugString(tmpbuf);
                OutputDebugString("\n");
        }
    if(r != -1)
      break;
    error = SOCKERRNO;
    if(error && error_not_EINTR)
      break;
    if(timeout_ms > 0) {
      pending_ms = timeout_ms - elapsed_ms;
      if(pending_ms <= 0)
        break;
    }
  } while(r == -1);

[......]

#endif /* HAVE_POLL_FINE */

I did write to this mailing list in order to know if some folks did
encounter the same issue. If not, I'll try to go ahead in debugging and
understanding the reason of the timeouts in select() calls.

Cheers,

Daniel

-----Original Message-----
From: Daniel Stenberg [mailto:daniel_at_haxx.se]
Sent: lundi 30 mai 2011 13:44
To: libcurl development
Cc: Motion Kollmorgen KAS Team East
Subject: Re: Timeout problem using libcurl 7.19.3 to send file from
windows

On Mon, 30 May 2011, Peppicelli, Daniel wrote:

> I'm facing a strange issue with libcurl and I do not understand if
> this is a "standard" behavior:

Let me first mention that since the libcurl version you are using, we
have done *at least* 383 bug fixes during the more than two years that
have passed since 7.19.3 was released... Your version also might contain
three known security vulnerabilities.

> I'm using libcurl to send multiple file to a web server on an embedded

> system. This web server can unfortunately not handle multipart
requests.

I figure you mean multiple files within the same multipart formpost
request.

> The problem is that for each transfer, libcurls falls one or two times

> in a
> select() timeout of 1000[ms]. Each files takes 2 seconds to
transfer...
> which is too much ofr our client.

I don't understand your point. What is too much? Are you saying that
libcurl sends the file too slowly or that it somehow wrongly times out
too much?

> On libcurl side, the select timeout is in select.c, in
> Curl_socket_ready() function when the windows api select() function is

> called. Since we are supporting windows XP on the client side, we can
> not use the macro HAVE_POLL_FINE.

But why is select() a problem in the first place?

-- 
  / daniel.haxx.se
Please be advised that this email may contain confidential 
information.  If you are not the intended recipient, please notify us 
by email by replying to the sender and delete this message.  The 
sender disclaims that the content of this email constitutes an offer 
to enter into, or the acceptance of, any agreement; provided that the 
foregoing does not invalidate the binding effect of any digital or 
other electronic reproduction of a manual signature that is included 
in any attachment.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-05-30