kern/92243: sendfile(2) returns early on files > 4GB

David Kelly dkelly at hiwaay.net
Tue Jan 24 08:30:39 PST 2006


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

From: David Kelly <dkelly at hiwaay.net>
To: "David G. Lawrence" <dg at dglawrence.com>
Cc: freebsd-gnats-submit at FreeBSD.org
Subject: Re: kern/92243: sendfile(2) returns early on files > 4GB
Date: Tue, 24 Jan 2006 10:29:13 -0600

 On Mon, Jan 23, 2006 at 11:09:08PM -0800, David G. Lawrence wrote:
 > > >How-To-Repeat:
 > > Get a file which is larger than 4G via ftpd, apache, or anything else which uses sendfile(2).
 > 
 >    Do you know if sendfile(2) is returning an error in the failure case?
 
 I don't know the method for attaching gdb to a running daemon, have
 never had need of it before. Have sprinkled printf's in ftpd and edited
 the return message trying to understand what is happening. I think
 sendfile is returning once and ftpd is calling it again then the 2nd
 time the count is zero so ftp returns "premature end." This is untouched
 stock RELENG6:
 
 230 User dkelly logged in.
 Remote system type is UNIX.
 Using binary mode to transfer files.
 ftp> get test/bigfile /dev/null
 local: /dev/null remote: test/bigfile
 229 Entering Extended Passive Mode (|||50786|)
 150 Opening BINARY mode data connection for 'test/bigfile' (4556820480 bytes).
 226 Transfer finished due to premature end of file.
 261853184 bytes received in 00:05 (48.76 MB/s)
 ftp>
 
 It always leaves exactly 4GB behind:
 
 dkelly at Grumpy {1009} dc
 16 o
 4556820480 261853184 - p
 100000000
 
 If I copy bigfile:
 
 dkelly at Grumpy {1010} cp -p test/bigfile test/big2
 
 Then the ftpd/sendfile works for the next few hours or days or until
 reboot. Doesn't matter if the file is hosted on my simple one-disk
 filesystem or my 2-disk gvinum striped filesystem.
 
 dkelly at Grumpy {1011} ftp localhost
 Trying ::1...
 Connected to localhost.home.
 220 Grumpy.DynDNS.org FTP server (Version 6.00LS) ready.
 Name (localhost:dkelly):
 331 Password required for dkelly.
 Password:
 230 User dkelly logged in.
 Remote system type is UNIX.
 Using binary mode to transfer files.
 ftp> get test/big2 /dev/null
 local: /dev/null remote: test/big2
 229 Entering Extended Passive Mode (|||50787|)
 150 Opening BINARY mode data connection for 'test/big2' (4556820480 bytes).
 226 Transfer complete.
 4556820480 bytes received in 02:11 (32.94 MB/s)
 ftp>
 
 
 -- 
 David Kelly N4HHE, dkelly at HiWAAY.net
 ========================================================================
 Whom computers would destroy, they must first drive mad.


More information about the freebsd-bugs mailing list