Project

General

Profile

Bug #2774

CGI request not handled

Added by tobbe303 4 months ago. Updated 4 months ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
mod_cgi
Target version:
Start date:
2016-11-28
Due date:
% Done:

100%

Missing in 1.5.x:

Description

Sending two consecutive request where the first request is for a CGI and the second is for a static file seem to trigger a race condition causing the CGI to be unhandled. No response is generated for the CGI request, the static file however is served.

The issue was observed when posting a large file to the CGI, then almost simultaneously fetching a spinner gif image.

Disabling cache in the browser (thus forcing update of the spinner graphic) makes this issue very reproducible.

If I'm not mistaken it seems to have something to do with the second request (static file) calling URIHANDLER_FUNC(cgi_is_handled) of mod_cgi replacing the current plugin data before the actual fork and exec of the cgi request takes place.

When the error happens I've observed that, in the function SUBREQUEST_FUNC(mod_cgi_handle_subrequest), the following handler is NULL.

mod_cgi.c, line 1445, if (!handler) return HANDLER_GO_ON; /*(should not happen; checked in cgi_is_handled())*/

A closer look at the array p->conf.cgi, passed to the cgi_get_handler the line before, showed that it was of zero length. Normally this array contains the entry ".cgi".

I'm on the master branch commit f635ae7a07f56db636ab557a5f24bbcaf0b1bcd9 on GitHub.

Attached is a lighttpd log file of the event (as much detail I could enable).

lighttpd-log.txt View (17.2 KB) tobbe303, 2016-11-28 11:42

Associated revisions

Revision 5bf5e1ad (diff)
Added by gstrauss 4 months ago

fix race in dynamic handler configs (reentrancy) (fixes #2774)

(thx tobbe303)

x-ref:
"CGI request not handled"
https://redmine.lighttpd.net/issues/2774

History

#1 Updated by gstrauss 4 months ago

  • Status changed from New to Patch Pending
  • Target version changed from 1.4.x to 1.4.44

Great detective work! Thank you! A fix will be committed to lighttpd git master shortly.
This issue also occurs in a number of the other dynamic handlers: cgi, proxy, scgi, webdav. mod_fastcgi was not affected.

#2 Updated by gstrauss 4 months ago

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

Also available in: Atom