0

I have a function running on a Go Web server that performs some analysis and then returns a response. It returns a JSON result set when calling its API interface with an HTTPS GET. The function is served with a handler using http.listenandserve(:80,nil) through a load balancer (SSL).

...https://example.com/getresults&inputdata=data      // data is a json array, authenticated via header

The response gets returned but it takes a few minutes to perform the analysis and respond with the results, which is a requirement. It works fine when I call it from within Go code, and it waits as required before moving on as designed (with an appropriate client timeout if it takes too long), however if I execute the HTTPS GET from the address bar of a browser, or from the command line using cURL, it times out in ~60 seconds with an HTTP 504 Gateway error. With the timeout the server, used solely for this analysis purpose, continues to run as the results are also stored to a logfile that I can see (that is expected since it's running in its own goroutine).

Is there something within Go such as a server property that is triggering the timeout in the latter two cases (browser address bar & cURL) when not called programmatically? Or would this be an OS setting that could be changed? Go server is running on Linux (Ubuntu).

Thanks.

  • 1
    It sounds like your load balancer has a 60s timeout. – Adrian Mar 28 '23 at 17:56
  • It'd be very useful to know what load balencer you're using as it's very likely it has it's own timeout configuration. Using cURL did you try increasing the timeout to a suffient one? – rhys_stubbs Mar 29 '23 at 06:36

0 Answers0