From owner-freebsd-bugs@FreeBSD.ORG Mon Dec 5 21:00:22 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org 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 36A9916A41F for ; Mon, 5 Dec 2005 21:00:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8B34743D55 for ; Mon, 5 Dec 2005 21:00:21 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id jB5L0LLU017815 for ; Mon, 5 Dec 2005 21:00:21 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id jB5L0LDx017812; Mon, 5 Dec 2005 21:00:21 GMT (envelope-from gnats) Date: Mon, 5 Dec 2005 21:00:21 GMT Message-Id: <200512052100.jB5L0LDx017812@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Deomid Ryabkov Cc: Subject: Re: bin/89100: premature EOF with ftpd on some large files X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Deomid Ryabkov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2005 21:00:22 -0000 The following reply was made to PR bin/89100; it has been noted by GNATS. From: Deomid Ryabkov To: bug-followup@FreeBSD.org, dkelly@hiwaay.net Cc: Subject: Re: bin/89100: premature EOF with ftpd on some large files Date: Mon, 05 Dec 2005 23:44:05 +0300 i have similar problem: sendfile(2) returns prematurely, when exactly 2^32 bytes left to transfer. this is demonstrated by ftpd (which uses sendfile), but applies to apache too (if configured with enablesendfile yes). in my case, sendfile misbehaves only when asked to send file residing on NFS-mounted filesystem. this seems to happen to all files > 4G resiging on NFS-mounted filesystems. those same files can be read without problem with read(2), therefore copying with cp(1) succeeds. while tracking down the problem i set up a local ftp server on my notebook, rooted at /stuff/ftp. i was able to download a large file residing on local hard disk without problem: nb[/stuff/ftp]# fetch -o /dev/null ftp://192.168.10.4/debian-31r0a-i386-binary-1.iso /dev/null 100% of 4469 MB 14 MBps 00m00s then i tried downloading the same file from NFS-mounted filesystem: nb[/stuff/ftp]# mount tux:/spool on /stuff/ftp/spool (nfs) nb[/stuff/ftp]# fetch -o /dev/null ftp://192.168.10.4/spool/distr/debian-31r0a-i386-binary-1.iso /dev/null 8% of 4469 MB 7310 kBps 09m30s fetch: /dev/null appears to be truncated: 391739392/4686706688 bytes and another one: nb[/stuff/ftp]# fetch -o /dev/null ftp://192.168.10.4/spool/distr/debian-31r0a-i386-binary-2.iso /dev/null 3% of 4223 MB 7367 kBps 09m37s fetch: /dev/null appears to be truncated: 133883904/4428851200 bytes in both cases, transfer ends at exactly 4294967296=2^32 bytes before actual end of file. one line of debug output added to ftpd.c shows that sendfile actually returns without error, with correct amount of transferred bytes: Dec 5 23:34:26 nb ftpd[55338]: sendfile returned 0, errno=2, cnt=391739392 Dec 5 23:39:21 nb ftpd[55352]: sendfile returned 0, errno=2, cnt=133883904