cURL / Mailing Lists / curl-library / Single Mail


Re: Two hangs in FTP

From: Daniel Stenberg <>
Date: Sat, 18 Jul 2009 00:07:49 +0200 (CEST)

On Fri, 17 Jul 2009, Anton Bychkov wrote:

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

I would be interested in how to reach those "dead cycles". Preferably with a
test case that repeats it of course. And I do assume you mean 7.19.5...

> 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).

That sounds completely wrong. FTP_QUIT is a legitimate state and should not
cause the state machine to stop. That's plain wrong.

> 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);
> }

I'm sorry but I don't understand your explanation. Why is this code not ever
setting 'select_res' to zero?

Received on 2009-07-18