Project

General

Profile

Bug #471

sendfile backends do not fall back to write/writev if they are not supported by the kernel

Added by Anonymous almost 12 years ago. Updated over 1 year ago.

Status:
Fixed
Priority:
Low
Assignee:
-
Category:
core
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:

Description

lighttped report error when uploading file using php on solaris sparc 9(sunos5.9)

(network_solaris_sendfilev.c.177) sendfile: Address family not supported by protocol family 124

tested 1.4.8 and 1.4.9


Related issues

Has duplicate Bug #987: error:network_freebsd_sendfile.c.175Fixed

Associated revisions

Revision c46f0ce0 (diff)
Added by gstrauss over 1 year ago

[core] fallback to write if sendfile not supported (fixes #471, #987)

x-ref:
"sendfile backends do not fall back to write/writev if they are not supported by the kernel"
https://redmine.lighttpd.net/issues/471
"error:network_freebsd_sendfile.c.175"
https://redmine.lighttpd.net/issues/987

github: closes #58

History

#1

Updated by Anonymous almost 12 years ago

same here. lighttpd 1.4.10, sunos 5.11 x86_64. problem is at src/connections.c:1013
when request content size > 64k, use another way to post to php: write all
request body to a file, and then use solaris sendfilev to write from this file fd to
php-fcgi unix socket. But /lib/64/libsendfile.so.1 which lighttpd links to does
not support to write to a unix socket. I don't know if there's any way of enabling
this if I recompile the libsendfile.so.

the workaround I am using is to disable solaris' sendfilev in
src/network_backends.h, but I don't know if solaris' sendfilev is much more
efficient than the linux sendfile call in solaris.

This has to be fixed.

-- atppp

#2

Updated by jan about 11 years ago

  • Status changed from New to Assigned

I need a login to sol10 to develop a patch for this. Can someone provide me with one ?

#3

Updated by Anonymous almost 11 years ago

It may not be the best way, but I seem to have solved it with:


            /* Solaris sendfilev() */
            if (-1 == (r = sendfilev(fd, &fvec, 1, &written))) {
                if (errno == EAFNOSUPPORT) {
                    buffer_prepare_copy(srv->tmp_buf, toSend);
                    lseek(ifd, offset, SEEK_SET);
                    if (-1 == (toSend = read(ifd, srv->tmp_buf->ptr, toSend))) {
                        log_error_write(srv, __FILE__, __LINE__, "ss", "read: ", strerror(errno));
                        close(ifd);
                        return -1;
                    }

                    if (-1 == (written = send(fd, srv->tmp_buf->ptr, toSend, 0))) {
                        log_error_write(srv, __FILE__, __LINE__, "ss", "write: ", strerror(errno));
                        close(ifd);
                        return -1;
                    }

                } else if (errno != EAGAIN) {
                    log_error_write(srv, __FILE__, __LINE__, "ssd", "sendfile: ", strerror(errno), errno);

                    close(ifd);
                    return -1;
                }

-- joe

#4

Updated by Anonymous over 10 years ago

Hi there,

I am suffering from this same error in our Rails app. We are using 1.4.13.
Has any progress been made on solving this?

I'm a web-developer and not too familiar with this lower-level stuff. Can I be of assistance in anyway as this is killing our production site (we just moved to text-drive who use OpenSolaris boxes).

Cheers.

-- lachy

#5

Updated by Anonymous over 10 years ago

The patch I posted above has been working perfectly for me. You should give it a try to see if it works for you too.

-- joe

#6

Updated by Anonymous over 10 years ago

Why hasn't this patch been added to the trunk? This is a pretty serious bug.

-- magnus

#7

Updated by Anonymous about 10 years ago

hi,
thanks for the fix.
We are using sol 10 and Lighttpd 1.4.18 which still has this problem.

-- Jason

#8

Updated by stbuehler over 9 years ago

If your OS doesn't provide a proper sendfile implementation (i.e. unable to send files over unix sockets), then just don't use it as network handler.

Of course it would be nice if lighttpd provided a fallback, but that should be done in a proper way and i don't know if someone wants to do this for 1.4.x as that would be a major change in my eyes.

I will not close this bug so others can find it (and i agree it really is a bug), but i don't think it will be fixed soon.

Perhaps can attach his fix as a real patch (diff -u origfile patchedfile).

#9

Updated by stbuehler over 9 years ago

This is of course a more generic problem with all platforms, so i will link them here.

#10

Updated by necrobious almost 9 years ago

setting:
server.network-backend = "writev"
in my lighthttpd.conf file fixed this for me, tmmv! see (http://www.lighttpd.net/2007/2/3/raw-io-performance) for potential impact.

-kirk
Solaris 10
lighttpd 1.4.19
php 5.2

#11

Updated by gstrauss over 1 year ago

  • Has duplicate Bug #987: error:network_freebsd_sendfile.c.175 added
#12

Updated by gstrauss over 1 year ago

  • Description updated (diff)
  • Status changed from Assigned to Patch Pending
  • Assignee deleted (jan)
  • Target version set to 1.4.40
#13

Updated by gstrauss over 1 year ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100

Also available in: Atom