curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

Re: When using ActiveMode of FTPS on Curl for Windows, it takes polling timeout time (1000msec) to establish DataConnection.

From: Yoshimasa Ohno via curl-library <curl-library_at_lists.haxx.se>
Date: Wed, 4 Sep 2024 20:41:29 +0900

Thanks for the response!

I tried a local build including
https://github.com/curl/curl/commit/a07ba37b5e88a89bf4bcc6b0c927f7a42d7ea4f2
Unfortunately, it did not solve the problem I am experiencing in my
environment.

Even just adding printf debugging.
I don't know where the real cause is, because the problem is no longer
reproduced.

One of the conditions for the occurrence of the Dalay problem seems to be
that the ReceivedServerConnect function exits in the socket unestablished
state.
ReceivedServerConnect function seems to occur when the following,
unestablished state comes through.
https://github.com/curl/curl/blob/6a9b71037a441eac28d3c7f629ac5801c01f99e2/lib/ftp.c#L572C1-L573C22
  case 0: /* Server connect is not received yet */
    break; /* loop */

When a problem occurs, there is a delay of timeout time (standard is 1
second, extended that way if modified) in the following
WSAWaitForMultipleEvents.
https://github.com/curl/curl/blob/6a9b71037a441eac28d3c7f629ac5801c01f99e2/lib/multi.c#L1366
    else { /* now wait... if not ready during the pre-check (pollrc == 0) */
      WSAWaitForMultipleEvents(1, &multi->wsa_event, FALSE,
(DWORD)timeout_ms,
                               FALSE);
    }

Is there anything I can try?

2024年9月3日(火) 16:59 Stefan Eissing via curl-library <
curl-library_at_lists.haxx.se>:

> I created https://github.com/curl/curl/pull/14766 as a fix for this.
>
> The bug was that the socket was not using POLLIN, but POLLOUT. So it never
> triggered an event when the FTP server tried to connect. That led to the
> connect only being noticed a second later when curl checks on all
> transfers.
>
> Hope this works for you.
>
>
> > Am 03.09.2024 um 08:13 schrieb Daniel Stenberg via curl-library <
> curl-library_at_lists.haxx.se>:
> >
> > On Sat, 31 Aug 2024, Yoshimasa Ohno via curl-library wrote:
> >
> >> I found that the timeout argument of curl_multi_poll, the literal 1000,
> was having an effect. Changing this to 3000 resulted in a 3 second wait.
> >
> > We believe there might be a bug in the code that sets what socket
> activity curl should wait for when waiting for the connect to happen. (A
> regression)
> >
> > Stefan is going to try to get a fix made and submitted soon.
> >
> > --
> >
> > / daniel.haxx.se
> > | Commercial curl support up to 24x7 is available!
> > | Private help, bug fixes, support, ports, new features
> > | https://curl.se/support.html
> > --
> > Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
> > Etiquette: https://curl.se/mail/etiquette.html
>
> --
> Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
> Etiquette: https://curl.se/mail/etiquette.html
>


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2024-09-04