httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Edmundsson <>
Subject Re: apr_brigade_insert_file() LFS/Linux issues
Date Thu, 04 May 2006 08:26:56 GMT
On Thu, 4 May 2006, Joe Orton wrote:

>>>> I've run into apr_brigade_insert_file() creating brigades that's not
>>>> possible to sendfile() (EINVAL), this is with httpd-2.2.2 on Ubuntu
>>>> Breezy Linux amd64 (64bit). The file in question is 4.3GB, and it
>>>> seems that sendfile() doesn't cope with that.
>>>> Has anyone else seen this?
>>> No, works fine here.  Can you get strace output for the failing call?
>> [pid   931] open("/httpcache/HU/zG/8j/_HJBmSBIt0F2CnvQ", O_RDONLY) = 11
>> ...
>> [pid   931] sendfile(10, 11, [4096], 4571090944) = -1 EINVAL (Invalid
>> argument)
> OK, what filesystem?  Colm had reported the same thing on Debian/IA64,
> which was on an NFS mount, IIRC.  If you adjust apr_brigade_insert_file
> to only allow buckets of MAX_BUCKET_SIZE regardless, i.e. change the
> conditional to:

This was on XFS and on an NFS mount. It should be noted that this 
works on a 32bit (also Ubuntu Breezy) machine with identical config.

On 32bit I get '#define HAVE_SENDFILE64 1' in 
srclib/apr/include/arch/unix/apr_private.h, on 64bit it's undefined.

>From <sys/sendfile.h>:
#ifndef __USE_FILE_OFFSET64
extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *__offset,
                          size_t __count) __THROW __nonnull ((3));
# ifdef __REDIRECT_NTH
extern ssize_t __REDIRECT_NTH (sendfile,
                                (int __out_fd, int __in_fd, __off64_t *__offset,
                                 size_t __count), sendfile64) __nonnull ((3));
# else
#  define sendfile sendfile64
# endif
#ifdef __USE_LARGEFILE64
extern ssize_t sendfile64 (int __out_fd, int __in_fd, __off64_t *__offset,
                            size_t __count) __THROW __nonnull ((3));

To me this looks like you'll get sendfile instead of sendfile64 unless 
you have asked for LFS-stuff, even on a 64bit platform.

>  if (length < MAX_BUCKET_SIZE) {
> does that work?

It probably won't since this seems to be an issue of using sendfile 
instead of sendfile64 since it's the sendfile syscall returning EINVAL 
and not apr.

  Niklas Edmundsson, Admin @ {acc,hpc2n}      |
  My favorite color?  Red.  No, BluAAAAAHHH!

View raw message