• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved fcgid timeout 60 seconds / End of script output before headers

Cihad Yavu

New Pleskian
Hi all,

We have a costumer that is having issues syncing data to his WordPress plugin from an external service that is hitting a 60 seconds timeout issue. The things that I have already done:

- Increased max_execution_time and max_input_time from 60 to 7200 in PHP settings
- Edited the general fcgid.conf and increased the iotimeout to 7200, FcgidMaxProcesses increased,
- In Apache Additional Settings, I have set FcgidBusyTimeout 7200 and FcgidIOTimeout, FcgidConnectTimeout and FcgidMaxRequestsPerProcess increased to a higher value
- In nginx Additional Settings, I have fastcgi_read_timeout 7200; proxy_send_timeout 7200; send_timeout 7200;
- Set PHP handler to FPM to no avail

The data that is being synced are pictures and is being stopped after 60s, hitting a 500 error. The domain is running on a 17.0.17 Linux installation with PHP 5.6 running FastCGI. There are also no remaining updates for this vServer and all Plesk patches have been applied.

P.S.: knowing 7200 seconds is really high, this was done in order to troubleshoot the problem. This has been going on since 2 weeks.
 
If your server generates a 500 error, please check your error_log entries what exactly the error message is and post it here.
 
Hi Peter,

I thought including it in the title was enough, but here you go:

[Tue Apr 11 11:17:45.589621 2017] [fcgid:warn] [pid 28434:tid 140065174968064] (104)Connection reset by peer: [client xx.xx.xx.xx:48854] mod_fcgid: error reading data from FastCGI server
[Tue Apr 11 11:17:45.589701 2017] [core:error] [pid 28434:tid 140065174968064] [client xx.xx.xx.xx:48854] End of script output before headers: xx.php

The sync-service that is sending the POST requests has let us know they are hitting a timeout issue after 60.001ms.

On all other servers this issue is resolved by raising the max_execution_time, but in this case it keeps falling back to the default 60s timeout. The server has been restarted a couple of times, Apache and nginx have been restarted and all vhosts were regenerated.
 
It is not proven that there is actually a timeout issue, is it? The issue may exist with the other provider, because they have a timeout in their systems that their system does not wait longer than 60 seconds on a response. On your system however, this can also be a PHP processing error. You should see the request from the external system in the access_log, then check what is happening with it on your system and whether the "error reading data" is actually logged 60 seconds later. It is probably not.

Most of the time when this error appears, the PHP script is failing to process data and returning an empty result instead. This empty output from PHP due to an error that was encountered results in the "error reading data from FastCGI server" followed by "End of script ...".

This can be due to many reasons, e.g. .htaccess rewrites prohibiting access to a specific resource, RAM too low for image processing, image processor not found, other resources that are needed inaccessible due to false permissions, openbasedir preventing access to resources and more. Endless possibilities. Just one thing very likely: Error in the PHP routine that is doing something on your server.
 
I have to give you credit for taking the problem into account and suggesting several causes, while the issue was resolved by changing the nameservers of the server. Topic can be closed.
 
Back
Top