I saw an issue with the same symptoms as Bug #1249:
2009-12-17 18:07:27: (network_writev.c.115) writev failed: Invalid argument 6
This happened on an embedded ARM Linux system (uclibc) when invoking a CGI program that produced lots of output.
The problem occurs because (as of lighttpd 1.4.23) the server tries to use sysconf(_SC_IOV_MAX) to determine the writev vector limit, but uclibc ends up returning -1 (invalid sysconf name), which is then interpreted as an unsigned value, effectively setting max_chunks to 0xffff. Thus, when producing output fast, the number of chunks produced will eventuall exceet the real limit (1024) and writev will fail.
The fix is to check whether sysconf() failed and, if so, default to a reasonable value (see patch below).
Updated by davidm over 13 years ago
- File network_writev.diff network_writev.diff added
Oops, here is the patch. Really.
Updated by stbuehler about 13 years ago
- Status changed from New to Invalid
- Assignee deleted (
Hm. I don't think this is our problem - "-1" can mean "unlimited" or "error"; in the latter case errno has to be set to the error; but there is only one error listed: EINVAL for "The value of the name argument is invalid." - but _SC_IOV_MAX is listed in the table after this: "The implementation shall support all of the variables listed in the following table and may support others.".
So imho this is a bug in uclibc.
Also available in: Atom