EIDA / mediatorws

EIDA NG Mediator/Federator web services
GNU General Public License v3.0
6 stars 6 forks source link

Avoid 504 gateway timeouts between Apache2 and mod_wsgi #104

Closed kaestli closed 4 years ago

kaestli commented 4 years ago

Specific requests may cause the federator to take a long time before it is able to return a chunk of data = a segment of the response stationXML (worst case: asking for station XML, with response, large network hosted at a single & slow end node, most [but not all] channels requested, specific time interval restrictions leading to complete cache miss). Currently, the web server returns http 504 gateway error if this takes more than 60 seconds. Then the client sees an error even if s/he is ready to wait longer.

propose to reconfigure this with at WSGIDaemonProcess parameter: socket-timeout=900 # seconds, e.g. further documentation: see https://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGIDaemonProcess.html

damb commented 4 years ago

Thanks, @kaestli.

However, I got the the error after 300s:

$ time curl -v "http://mediator-testing.ethz.ch/fdsnws/station/1/query?net=Z3&start=1999-01-11&level=response&format=xml"
*   Trying 129.132.144.214...
* TCP_NODELAY set
* Connected to mediator-testing.ethz.ch (129.132.144.214) port 80 (#0)
> GET /fdsnws/station/1/query?net=Z3&start=1999-01-11&level=response&format=xml HTTP/1.1
> Host: mediator-testing.ethz.ch
> User-Agent: curl/7.58.0
> Accept: */*
> 
< HTTP/1.1 504 Gateway Timeout
< Date: Wed, 08 Jan 2020 16:25:16 GMT
< Server: Apache/2.4.29 (Ubuntu)
< Content-Length: 337
< Content-Type: text/html; charset=iso-8859-1
< 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>504 Gateway Timeout</title>
</head><body>
<h1>Gateway Timeout</h1>
<p>The gateway did not receive a timely response
from the upstream server or application.</p>
<hr>
<address>Apache/2.4.29 (Ubuntu) Server at mediator-testing.ethz.ch Port 80</address>
</body></html>
* Connection #0 to host mediator-testing.ethz.ch left intact

real    5m0.139s
user    0m0.032s
sys 0m0.017s

Hence, there must be another timeout configuration related with this issue.

damb commented 4 years ago

References: #69

damb commented 4 years ago

Closed with #109.