In case anyone else runs into this, it turns out the 504 was being returned by our AWS ELB (an overlooked client timeout). See https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-idle-timeout.html for details on setting the timeout.
Arvind On 7/31/17 8:49 PM, Arvind Sujeeth wrote: > Hi all, > > We're encountering an issue where a longer API request ends up aborting just > after 60s (the DB query itself takes approximately 60s) and returning a 504 > (Gateway Timeout). The exception thrown in the logs is attached. It looks > like the socket is suddenly being closed; I suspect it has something to do > with either Tomcat or JDBC timeouts, but all of my attempts to set those to > longer values (connectionTimeout, keepAliveTimeout in server.xml, > removeAbandonedTimeout in the JDBC connection) have not had any affect. > > The timeouts do not seem to be triggered client-side (they occur even if we > set an indefinite timeout, or even just using curl which has a longer default > timeout). > > Has anyone run into this before with long-running queries or API calls and > found a solution? > > Best, > Arvind >
