Project

General

Profile

Bug #2744

1.4.40/41 writev failed: Socket is not connected (fastcgi,scgi,proxy)

Added by gstrauss 10 months ago. Updated 10 months ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
core
Target version:
Start date:
2016-08-07
Due date:
% Done:

100%

Missing in 1.5.x:

Description

pkubaj reported "writev failed: Socket is not connected" issues with owncloud in a VM jail under FreeBSD

(network_writev.c.88) writev failed: Socket is not connected 9
(mod_fastcgi.c.3075) connection was dropped after accept() (perhaps the fastcgi process died), write-offset: 0 socket:...

In 1.4.40, lighttpd was modified to defer reading request body until running the dynamic handler routines. With this change, under certain conditions, lighttpd might attempt to write to a backend socket after EINPROGRESS but before the connection is full established. The fix is for lighttpd to enforce waiting for POLLWR event from backend socket before continuing. The conditions under which lighttpd (erroneously) did not wait for socket connection to be established include if streaming input to backend and new data arrived from client before socket connection to backend established; in cases where backend fail and a new connection attempt was made to a different backend; and in cases where the request body input was completely read from client on first try, and connection state transitioned from CON_STATE_READ_POST to CON_STATE_HANDLE_REQUEST.

Associated revisions

Revision 666b9fd7 (diff)
Added by gstrauss 10 months ago

[core] enforce wait for POLLWR after EINPROGRESS (fixes #2744)

mod_fastcgi, mod_scgi, and mod_proxy must enforce wait for POLLWR
after EINPROGRESS or else getsockopt(fd, SOL_SOCKET, SO_ERROR, ...)
may succeed even though socket connection is not yet established,
and subsequent writev() will fail ENOTCONN.

(thx pkubaj)

x-ref:
"1.4.40/41 writev failed: Socket is not connected (fastcgi,scgi,proxy)"
https://redmine.lighttpd.net/issues/2744

History

#1 Updated by gstrauss 10 months ago

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

Also available in: Atom