https://bz.apache.org/bugzilla/show_bug.cgi?id=64709

            Bug ID: 64709
           Summary: mod_cgi not returning 504 properly after TimeOut
           Product: Apache httpd-2
           Version: 2.4.43
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_cgi
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

My TimeOut directive is set to 300 seconds, but I get a 504 error in my browser
when using mod_cgi after 600 seconds.

Interestingly, Apache logs the following after 300 seconds, but it doesn't
return the response to my browser, and it does not terminate or kill the CGI
script. The CGI script keeps running and my browser keeps waiting for content
from Apache.

[Fri Sep 04 03:16:13.955573 2020] [cgi:warn] [pid 7709] [client
172.20.0.1:42238] AH01220: Timeout waiting for output from CGI script
/kohadevbox/koha/tools/import_borrowers.pl, referer:
http://localhost:8081/cgi-bin/koha/tools/import_bo
rrowers.pl
[Fri Sep 04 03:16:13.955703 2020] [cgi:error] [pid 7709] [client
172.20.0.1:42238] Script timed out before returning headers:
import_borrowers.pl, referer:
http://localhost:8081/cgi-bin/koha/tools/import_borrowers.pl

Then 300 seconds later, Apache logs another timeout, and that's when I receive
a 504 error in my browser and the CGI script is killed.

[Fri Sep 04 03:21:14.027398 2020] [cgi:warn] [pid 7709] [client
172.20.0.1:42238] AH01220: Timeout waiting for output from CGI script
/kohadevbox/koha/tools/import_borrowers.pl, referer:
http://localhost:8081/cgi-bin/koha/tools/import_bo
rrowers.pl

I've poked around the httpd and apr source code, but I can't find the answer. 

I've also used the ScriptLog directive, and it records a 504 in the log after
the first timeout, which is consistent with the "server/util_script.c" code
that shows returns HTTP_GATEWAY_TIME_OUT.  
%% [Fri Sep 04 03:16:13 2020] POST /cgi-bin/koha/tools/import_borrowers.pl
HTTP/1.1
%% 504 /kohadevbox/koha/tools/import_borrowers.pl

It seems to me like the CGI script cleanup isn't happening in a timely fashion.
I'm guessing that Apache must try to read from the CGI process 1 last time
before terminating it, and that is where the 2nd timeout happens and the actual
HTTP response is returned to the browser.

But that's just a guess.

I'm hoping that you folks will be able to find the answer.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to