The timeout specified has expired

Hi,

I’m running HestiaCP lastest version with Apache2, nginx and PHP-FPM for multi-php versions

I have an issue when installing an addon on my favorite CMS.
On the log I have this :

[Mon Aug 03 23:18:41.597564 2020] [proxy_fcgi:error] [pid 6778:tid 140491299469056] (70007)The timeout specified has expired: [client 151.xxx.bbb.227:0] AH01075: Error dispatching request to : (polling), referer: https://domain.eu/manager/?a=workspaces

I have found 2 topics on this forum :

and followed this link : php - Apache proxfy_fcgi - Error dispatching request to - Stack Overflow

What I did and what it doesn’t work :

  • add the line RequestReadTimeout handshake=0 header=20-600,MinRate=500 body=20,MinRate=500 found on stackoverflow to the file /etc/apache2/mods-enabled/reqtimeout.conf

  • add the followed lines to /etc/apache2/mods-enabled/fcgid.conf :

        FcgidIdleTimeout 600
        FcgidProcessLifeTime 600FcgidConnectTimeout 600
        FcgidIOTimeout 600
        ProxyTimeout 600
    
  • add the followed lines to /home/USERNAME/conf/web/DOMAIN.TLD/apache2.conf_fcgi :

    FcgidIdleTimeout 600
    FcgidProcessLifeTime 600
    FcgidConnectTimeout 600
    FcgidIOTimeout 600
    Timeout 600
    ProxyTimeout 600
    

After each action, I have restarted apache2 service

What did I missed ?

Maybe try this

The issue is that your PHP code doing longer then you Apache2 time out

Thanks for the tips… the file is not existing so I try several alternatives without more success.
In fact, the point it is not to change locally (for the website who needs) the max_execution_time value ?
How to doing this with php-fpm ?

Nope… I find the way to change the max_execution_time value in my personnalized template.
Edit the file /usr/local/hestia/data/templates/web/php-fpm/my_template.tpl and add at the correct place :

php_admin_value[max_execution_time] = 600

After a v-rebuild-web-domain the phpinfo() take the new vallue.

However, the issue is still there : when I’m running the script, the error is still there :

[proxy_fcgi:error] [pid 111278:tid 140699739535104] (70007)The timeout specified has expired: [client 151.ccc.eee.227:0] AH01075: Error dispatching request to : (polling), referer: https://domain.eu/manager/?a=workspaces

:frowning:

are you uploading a file for the addon install? if max-execution time does not fix, there usually is also a timelimit on uploads (max_input_time) I think the default is about 30 seconds?

I finally find the issue !
What I do :

Edit /etc/apache2/apache2.conf and change the Timeout value to 600
systemctl restart apache2

Edit /etc/mysql/my.cnf and change value like this :

[client]
port=3306
socket=/var/run/mysqld/mysqld.sock

[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock

[mysqld]
user=mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock
port=3306
basedir=/usr
datadir=/var/lib/mysql
tmpdir=/tmp
lc-messages-dir=/usr/share/mysql
log_error=/var/log/mysql/error.log
sql_mode=""

symbolic-links=0
local-infile=0

skip-external-locking
key_buffer_size = 16M
#max_allowed_packet = 1M
max_allowed_packet = 100M
table_open_cache = 10
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 240K

#innodb_use_native_aio = 0
innodb_file_per_table

max_connections=30
max_user_connections=20
wait_timeout=100
interactive_timeout=50
long_query_time=5

!includedir /etc/mysql/conf.d/

And finally :slight_smile:

 systemctl restart  mysql

I think I had two limits which cause the issue : one under apache2 and another one with mysql

Thanks for all your answers, it’s help me to dig further :slight_smile:

3 Likes

glad you got it solved :+1:

keep in mind that timeouts are there for a reason. mainly to protect your box from running processes endlessly where they are not supposed to or because of badly programmed stuff etc.

so while of course it can be just fine to increase settings slightly or handle a specific single use case, I’d always recommend to check if this also is a reasonable permanent adjustment :wink:

yes you are right :+1:

Hi Hedy, can you please clarify what you changed in your MYSQL file. Is it just that you commented out those two lines or you changed from 1M to 100M for your max_allowed_packet. What about the line of #innodb_use_native_aio?

I’m just curious to know what you changed in MySQL config.

I just migrated several sites over to HestiaCP from VestaCP so I am new to using this fastCGI, which was not in use on previous server. I noticed that all my sites are throwing this timeout error caused by the Wordpress Ewww Image Optimizer plugin.

This is an example of the error, I think it’s the same issue you had, correct?

[Thu Apr 15 13:45:07.300522 2021] [proxy_fcgi:error] [pid 54942:tid 139779576428288] (70007)The timeout specified has expired: [client 1XX.XXX.XXX.XXX:0] AH01075: Error dispatching request to : (polling), referer: https://www.sitename.com/wp-admin/admin-ajax.php?action=wp_ewwwio_media_optimize&nonce=b6c44224e7

I see many timeout values listed in the config files for both the Apache2 config (timeout, KeepAliveTimeout), as well as the Nginx config (send_timeout, proxy_connect_timeout, proxy_send_timeout, proxy_read_timeout) files.

And I see a lot of articles with people talking about changing the value if different files. I would like to avoid having to troubleshoot trial and error of changing all these values.

Is it just the basic timeout value specified in the apache config (/etc/apache2/apache2.conf) file that needs to be edited? In my case, by default it’s set to 30 seconds, perhaps I can just try 60 seconds.

# Global configuration
PidFile ${APACHE_PID_FILE}
Timeout 30
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 10

Btw, this post on stackexchange recommends to update to update both Timeout and ProxyTimeout values in the apache config files. however, I don’t see a variable for ProxyTimeout listed. Is this somewhere else, or should I just add that line to this file. You didn’t mention it in your fix, so that’s why I am asking.