From owner-freebsd-bugs@FreeBSD.ORG Wed Oct 13 17:40:25 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5FB6E16A543 for ; Wed, 13 Oct 2004 17:40:25 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 368E043D54 for ; Wed, 13 Oct 2004 17:40:25 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i9DHePc3037565 for ; Wed, 13 Oct 2004 17:40:25 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i9DHePQw037564; Wed, 13 Oct 2004 17:40:25 GMT (envelope-from gnats) Resent-Date: Wed, 13 Oct 2004 17:40:25 GMT Resent-Message-Id: <200410131740.i9DHePQw037564@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Oleg Koreshkov Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7844116A4CE; Wed, 13 Oct 2004 17:38:58 +0000 (GMT) Received: from ns.salut.ru (ns.salut.ru [194.67.150.71]) by mx1.FreeBSD.org (Postfix) with ESMTP id A735543D41; Wed, 13 Oct 2004 17:38:57 +0000 (GMT) (envelope-from okor@ns.salut.ru) Received: from ns.salut.ru (ns.salut.ru [194.67.150.71] (may be forged)) by ns.salut.ru (8.12.11/8.12.11) with ESMTP id i9DHcuNs090237; Wed, 13 Oct 2004 21:38:56 +0400 (MSD) (envelope-from okor@ns.salut.ru) Received: (from okor@localhost) by ns.salut.ru (8.12.11/8.12.11/Submit) id i9DHctAx090236; Wed, 13 Oct 2004 21:38:55 +0400 (MSD) (envelope-from okor) Message-Id: <200410131738.i9DHctAx090236@ns.salut.ru> Date: Wed, 13 Oct 2004 21:38:55 +0400 (MSD) From: Oleg Koreshkov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: yar@FreeBSD.org Subject: bin/72649: ftpd process can hang with high cpu load X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Oleg Koreshkov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Oct 2004 17:40:25 -0000 >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: