bin/89100: premature EOF with ftpd on some large files

David Kelly dkelly at
Mon Dec 5 21:51:22 GMT 2005

The following reply was made to PR bin/89100; it has been noted by GNATS.

From: David Kelly <dkelly at>
To: Deomid Ryabkov <myself at>
Cc: bug-followup at
Subject: Re: bin/89100: premature EOF with ftpd on some large files
Date: Mon, 5 Dec 2005 15:39:36 -0600

 On Mon, Dec 05, 2005 at 11:44:05PM +0300, Deomid Ryabkov wrote:
 > 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.
 What I find is that the files "break" somehow for sendfile() once they
 have aged a bit on the filesystem. "cp -p" the problem file to the same
 filesystem and sendfile() (via ftpd) sends the copied file correctly
 today but won't a day or two later.
 Guess I should try a reboot after copy to see if that breaks the file.
 Its as if sendfile() doesn't know that it has not finished its job.
 Possibly a fresh copy has metadata cached by the kernel but sendfile()
 quits rather than fetch needed metadata if its missing.
 Of course this worked in RELENG_5.
 David Kelly N4HHE, dkelly at
 Whom computers would destroy, they must first drive mad.

More information about the freebsd-bugs mailing list