bin/89100: premature EOF with ftpd on some large files
Deomid Ryabkov
myself at rojer.pp.ru
Mon Dec 5 21:00:22 GMT 2005
The following reply was made to PR bin/89100; it has been noted by GNATS.
From: Deomid Ryabkov <myself at rojer.pp.ru>
To: bug-followup at FreeBSD.org, dkelly at 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
<snip>
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
More information about the freebsd-bugs
mailing list