Ticket #471 (assigned defect)

Opened 3 years ago

Last modified 3 months ago

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

Reported by: anonymous Assigned to: jan (accepted)
Priority: low Milestone:
Component: core Version: 1.4.x-svn
Severity: normal Keywords:
Cc: Blocking:
Need Feedback: 0

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

Attachments

Change History

02/16/2006 02:07:42 AM changed by atppp

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.

11/15/2006 12:45:57 PM changed by jan

  • status changed from new to assigned.

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

11/30/2006 11:50:56 PM changed by joe@thrallingpenguin.com

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;
				}

06/06/2007 12:10:32 PM changed by lachy@mintd.com

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.

06/06/2007 05:23:47 PM changed by joe@thrallingpenguin.com

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.

06/10/2007 06:46:53 PM changed by magnus@smilingplants.com

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

10/10/2007 03:23:58 PM changed by Jason

  • version changed from 1.4.x to 1.4.18.
  • blocking changed.
  • pending changed.

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

04/24/2008 08:56:03 AM changed by stbuehler

  • priority changed from high to low.
  • version changed from 1.4.18 to 1.4.x-svn.
  • summary changed from sendfile error on solaris9 to sendfile error on solaris (unix sockets not supported).

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 joe@thrallingpenguin.com can attach his fix as a real patch (diff -u origfile patchedfile).

04/24/2008 09:03:12 AM changed by stbuehler

  • summary changed from sendfile error on solaris (unix sockets not supported) to sendfile backends do not fall back to write/writev if they are not supported by the kernel.

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


Add/Change #471 (sendfile backends do not fall back to write/writev if they are not supported by the kernel)




Change Properties