Question

We're getting 504 Gateway Timeouts on AWS from a Drupal 7 site at 60 seconds, but everything AFAIK is greater than that. The timeout is specifically during running the feeds_source_import in Ultimate Cron.

We have a NLB with two TCP listeners that forward to the IPs of an ALB. According to the docs, the NLB has a timeout of 350 seconds for TCP connections. https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#connection-idle-timeout

The ALB is using an HTTP and HTTPS listener, and we have the Idle Timeout set to 300 seconds.

Finally on the servers themselves are running CentOS 7.7, Apache 2.4 and PHP-FPM 7.2. reqtimeout_module is turned off completely. Here are some values from php.ini:

max_execution_time = 300
max_input_time = 120
max_input_vars = 4000
memory_limit = 300M
default_socket_timeout = 120

And apparently cron lock time is set to 240 in Drupal Core. https://stackoverflow.com/a/9220479/5004648

Is there anything else we're missing that would terminate the connection at 60 seconds?

Given that we have several feeds, I decided to try to also run the importer manually by visiting: /import/video_importer and also get a timeout. For reference, the feed is pulling only a 128KB CSV file that has 912 lines.

Was it helpful?

Solution

Solved. It was the timeout of the proxy connection to PHP-FPM. It involves going down a rabbit-hole of Apache values and defaults so strap in.

As per ProxyPass the proxy default of connectiontimeout is timeout.

The default value of timeout is ProxyTimeout

The default of ProxyTimeout is the core Apache TimeOut

The default of TimeOut is 60. So there you go.

I set a value of TimeOut 180 in my Virtualhost for the site in question and the import went through.

Now just to wrangle all these values back down to a sensible level now that I know the culprits.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top