openskope / skope-interface

The new SKOPE web portal interface.
https://www.openskope.org
4 stars 2 forks source link

Gracefully handle long processing time associated with some graph generation. #154

Closed jterstriep closed 6 years ago

jterstriep commented 6 years ago

Keith's document suggests that we figure out how to decide if too big an area is selected and display “Select a point or smaller area”. Alternatively, we could have some sort of timeout associated with graph request.

Zodiase commented 6 years ago

The timeout must be handled on the server otherwise the client can easily DDoS the server. I'd expect the server to return some sort of 400 Bad Request or 413 Payload Too Large error stating "the request is too large".

tmcphillips commented 6 years ago

Do you want to be able to specify a timeout in the timeseries request? There will be a configurable default timeout period on the server.

Zodiase commented 6 years ago

@tmcphillips well it's a complicated issue but the simple answer would be for the server to assume a default timeout that could be very short (like 5 seconds?). On top of which perhaps we can then allow the client to "suggest"/override that value if that's something actually useful, which I actually doubt since the client knows very little to assume the complexity of the job or have a reasonable expectation. Also it's still a big "welcome to DDoS me" sign if the client can specify how long the server should stall...

So for the short term I think it should suffice to set an arbitrary timeout threshold, until we re-evaluate how we consistently handle analysis of varies magnitudes in a bigger picture.

Zodiase commented 6 years ago

Client side needs to recognize the error code / message and display a specific error (ask the user to select a smaller area?)

tmcphillips commented 6 years ago

The 400 Bad Request response returned by the service when the processing time for a request is excessive has an error message starting with "External process exceeded time limit". See timeseries.timeout.tests.js. This version of the timeseries service is now running on the staging server.

The default timeout (currently 5000 ms) is configured via an environment variable (TIMESERIES_MAX_PROCESSING_TIME) in the Dockerfile and can be overridden by docker-compose. A 'timeout' value can be specified in the request (primarily for testing purposes) but is ignored if it exceeds the timeout value given by the server configuration.