'How to solve issue with FastCGI: "Error reading data from FastCGI server"

My application contains some heavy processes (heavy db queries like insert/update/delete queries by doctrine) and in some cases I get the following errors on the MySQL NGINX + PHP 7.4:

[Fri Apr 15 03:14:11.199479 2022] [fcgid:warn] [pid 2237536:tid 139805102909184] (104)Connection reset by peer: [clientx:50558] mod_fcgid: error reading data from FastCGI server
[Fri Apr 15 03:14:11.199523 2022] [core:error] [pid 2237536:tid 139805102909184] [client x:50558] End of script output before headers: index.php

The issue disappeared for a few days when I adjusted following variables:

FcgidBusyTimeout 1800
FcgidIOTimeout 1800

I adjusted also configuration for PHP (memory limit and max_execution_time).

I can see that problem occurs again (I think the process has more queries to perform). What else should I change for the FastCGI config to fix this issue?

Thank you in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source