cURL / Mailing Lists / curl-library / Single Mail


Two hangs in FTP

From: Anton Bychkov <>
Date: Fri, 17 Jul 2009 17:04:30 +0400


During upload to the ftp the library (version 7.9.15) sometimes hangs.
I discovered two places where it runs in dead cycle.

The first one is in function ftp_easy_statemach() at ftp.c:2992.
  while(ftpc->state != FTP_STOP)
Sometimes ftpc->state equals FTP_QUIT here, therefore condition is never met.
I fixed it by changing to
 while(ftpc->state != FTP_STOP && ftpc->state != FTP_QUIT).

The second issue is in Curl_readwrite function (transfer.c:1633).
It seems the following piece of code (transfer.c:1666) does not work
as expected, because
'select_res' variable becomes 0 at some time and never becomes non-zero:
   if(!select_res) { /* Call for select()/poll() only, if read/write/error
                         status is not known. */
       select_res = Curl_socket_ready(fd_read, fd_write, 0);
Therefore readwrite_data() and readwrite_upload() functions are not
called later in the function
and 'done' variable is never set to true at the end of the function.

These two issues are not 100% reproducible under the same machine
(windows xp sp3) and not reproduce under windows 7 machine.

I know this information is not enough to find the problem, so let me
know what else I can provide to you.
I really appreciate your help in fixing these issues.
Received on 2009-07-17