Project

General

Profile

Actions

Bug #471

closed

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

Added by Anonymous almost 19 years ago. Updated over 8 years ago.

Status:
Fixed
Priority:
Low
Category:
core
Target version:
ASK QUESTIONS IN Forums:

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 1 (0 open1 closed)

Has duplicate Bug #987: error:network_freebsd_sendfile.c.175FixedActions
Actions #1

Updated by Anonymous almost 19 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

Actions #2

Updated by jan about 18 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 ?

Actions #3

Updated by Anonymous about 18 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

Actions #4

Updated by Anonymous over 17 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

Actions #5

Updated by Anonymous over 17 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

Actions #6

Updated by Anonymous over 17 years ago

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

-- magnus

Actions #7

Updated by Anonymous about 17 years ago

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

-- Jason

Actions #8

Updated by stbuehler over 16 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).

Actions #9

Updated by stbuehler over 16 years ago

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

Actions #10

Updated by necrobious almost 16 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

Actions #11

Updated by gstrauss over 8 years ago

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

Updated by gstrauss over 8 years ago

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

Updated by gstrauss over 8 years ago

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

Also available in: Atom