Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Oct 2004 21:38:55 +0400 (MSD)
From:      Oleg Koreshkov <okor@NONEXISTENT.zone.salut.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        yar@FreeBSD.org
Subject:   bin/72649: ftpd process can hang with high cpu load   
Message-ID:  <200410131738.i9DHctAx090236@ns.salut.ru>
Resent-Message-ID: <200410131740.i9DHePQw037564@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         72649
>Category:       bin
>Synopsis:       ftpd process can hang with high cpu load
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 13 17:40:24 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Oleg Koreshkov (okor (AT) zone.salut.ru)
>Release:        FreeBSD 4.10-RELEASE-p2 i386 (CURRENT has the same bug)
>Organization:
none
>Environment:
FreeBSD 4.10
>Description:
        ftpd process can consume 100% CPU doing nothing, looping endless loop,
        if transferd file was overwritten during transfer.
        If client of this session hangs, this ftpd process can live quite a
        long time (2 hours or even more).
>How-To-Repeat:
        Start transfer (TYPE I) of big file or delay transfer by ipfw pipe.
        In another ftp session overwrite this file with smaller size (size must be > 0).
        First ftpd process gets in to endless loop.
>Fix:
--- ftpd.c
+++ ftpd.c
@@ -2034,6 +2034,22 @@
 
 					goto data_err;
 				}
+
+				/*
+				 * sendfile(2) can return zero bytes written
+				 * (cnt == 0), without indicating error,
+				 * when file was truncated (by another process)
+				 * during transfer.
+				 * We consider this case as temporary error,
+				 * however it possible to treat it
+				 * as successful transfer completion.
+				 */
+				if (cnt == 0) {
+					transflag = 0;
+					reply(450, "File was overwritten "
+					    "during transfer.");
+					return (-1);
+				}
 			}
 
 			transflag = 0;
>Release-Note:
>Audit-Trail:
>Unformatted:
         



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200410131738.i9DHctAx090236>