Thanks Jerome. I suspected it was something on the server side, and you were right – it was!
We are running php-fpm, serving various scripts. The php scripts that start outputting data within a few seconds run just fine, even if they ran longer than 60 seconds. Some of them run for over 10 minutes!
The issue only affected scripts that ran longer for a minute before giving any output, for example long-running scripts that spit out JSON.
So, the solution:
There is a config directive called request_terminate_timeout: “The timeout for serving a single request after which the worker process will be killed”. By default, the directive is commented out (unset). The documentation states that the default setting is ‘0’, for unlimited time. So I assumed that since it was commented out, it would default to unlimited – right?
In reality, if unset (e.g. commented out), the default becomes 60 seconds. So while I assumed that php-fpm was allowing unlimited time for the script to complete, it was actually killing it after 60 seconds.
Un-commenting this directive fixed the issue.
request_terminate_timeout = 0