how to prevent Heroku H12 "request timeout" for long-running process on Java REST server

182 Views Asked by At

We have a Jersey/Grizzly server which serves as our REST backend. Certain requests can easily take longer than 30s to process, which is perfectly normal. Sadly, Heroku terminates the connection after 30s with a H12 "request timeout" error.

It would appear that in order for a request to take longer than 30s, the server must periodically send some data to keep the connection open. See here: https://devcenter.heroku.com/articles/limits#http-timeouts

So the question is: How does one send data without terminating the response?

Here is how we create our server:

final String baseUri = "http://0.0.0.0:" + port;
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(URI.create(baseUri), rc);
0

There are 0 best solutions below