Project

General

Profile

Actions

Bug #2774

closed

CGI request not handled

Added by tobbe303 about 8 years ago. Updated about 8 years ago.

Status:
Fixed
Priority:
Normal
Category:
mod_cgi
Target version:
ASK QUESTIONS IN Forums:

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


Files

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

Updated by gstrauss about 8 years 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.

Actions #2

Updated by gstrauss about 8 years ago

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

Also available in: Atom