Welcome! Please see the About page for a little more info on how this works.

0 votes
in Ions by

We have some ring routes in our HTTP direct ring handler, which returns some Excel files, which are constructed on the fly.

This handler sometimes runs for more than a minute, resulting in the following error:
HTTP ERROR 503 Async servlet timeout URI: /... STATUS: 503 MESSAGE: Async servlet timeout SERVLET: cognitect.http_endpoint.jetty.FnServlet-49bf6f8c Powered by Jetty:// 9.4.48.v20220622

How can we raise this timeout to ~5minutes, which is the maximum timeout of AWS NLBs?

(We are exposing the HTTP direct ion endpoint to the public internet via an AWS NLB, to avoid the 30s timeout and 10MB response payload limit of the AWS API Gateway)

Multiple sources on the internet - eg. https://github.com/ring-clojure/ring/issues/299 - mention a org.eclipse.jetty.server.HttpChannelState.DEFAULT_TIMEOUT Java property which is supposed to affect Jetty's async context timeout.

Since the change of this property at runtime is not picked up by a running jetty instance, we have added provided it as a startup option, via the OverrideSettings CloudFormation template parameter:

`
{:OverrideSettings
(str "export JVM_FLAGS=\"$JVM_FLAGS"

  " -Dclojure.server.repl="
  "{:address,\\\"0.0.0.0\\\",:port,50505,:accept,clojure.core.server/repl}"
  " -Dorg.eclipse.jetty.server.HttpChannelState.DEFAULT_TIMEOUT=300000"
  "\"")}

`

It is indeed observable within the ion JVM process:
(Long/getLong "org.eclipse.jetty.server.HttpChannelState.DEFAULT_TIMEOUT") => 300000

Yet we are getting a 503 timeout response from the cognitect.http_endpoint.jetty.FnServlet-49bf6f8c servlet after 1 minute still.

Request, which take less then a minute work as expected.

Please log in or register to answer this question.

...