Project

General

Profile

Actions

Bug #2123

closed

writev failed

Added by davidm over 14 years ago. Updated about 14 years ago.

Status:
Invalid
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

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).


Files

network_writev.diff (594 Bytes) network_writev.diff Proposed fix davidm, 2009-12-18 03:01
Actions #1

Updated by davidm over 14 years ago

Oops, here is the patch. Really.

Actions #2

Updated by stbuehler about 14 years ago

  • Status changed from New to Invalid
  • Assignee deleted (jan)

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.

Actions

Also available in: Atom