Webmail with Gateway Timeout

In the moment to login to webmail Roundcube (user and password) appears a message:

Gateway Timeout

The gateway did not receive a timely response from the upstream server or application.

Log Apache:

[Sat Nov 14 20:37:29.289623 2020] [proxy_fcgi:error] [pid 29606:tid 140413880985344] (70007)The timeout specified has expired: [client AAA.BBB.CCC.DDD:0] AH01075: Error dispatching request to : (polling), referer: http://mail.mydomain.com/?_task=login

I use hestiacp with apache + nginx + php-fpm (multi version)

How to I can fix?

Thanks for the informations, not sure why it occures and how to fix. A suggestion after a short discussion in the dev chat would be to increase the timeouts, but theoretically this should not be needed: https://stackoverflow.com/questions/33375823/apache-proxfy-fcgi-error-dispatching-request-to

Maybe you could try to increase them and let us know if something has changed.

Getting this issue.

Some clients complaining that they can’t access via webmail. I couldn’t reproduce the error but from the error logs I have the same issue.

# cat /var/log/apache2/error.log | grep xxx.com
[Tue Jan 26 10:42:21.858970 2021] [proxy_fcgi:error] [pid 19105:tid 139808391276288] (70007)The timeout specified has expired: [client xx.xx.xx.xx:0] AH01075: Error dispatching request to : (polling), referer: http://webmail.xxx.com/?_task=login

There are two proposed solutions but I am not quite sure which config file should I edit and if it will be overwritten upon upgrade.

Solution1: increase request_terminate_timeout value located in my /etc/php-fpm.d/www.conf file.
Is it safe to edit www.conf? Will it get overwritten? Is this solution advisable?

Solution2: add RequestReadTimeout handshake=0 header=20-600,MinRate=500 body=20,MinRate=500 to apache
Which file should I edit? Will it get overwritten?

Both will get overwritten. Probably we should update the www.conf then so every get updated…

For Solution2 which file should I edit?

For option 2 you might need an aditional module

https://httpd.apache.org/docs/2.4/mod/mod_reqtimeout.html

Maybe we could try to increase the request_terminate_timeout a bit more in hestia.

I can’t find the /etc/php-fpm.d/ directory.

/etc/php/7.4/fpm/pool.d/

Thank you very much @eris I added
request_terminate_timeout 30s
to
/etc/php/7.4/fpm/pool.d/www.conf

Let’s see if it works.

If it does, shall I make a pull request?

Yes you can

Okay. I was having a timeout every 1 to 5 minutes. Since I applied the change. 0 timeouts in 6 hours. Fixed.

added: request_terminate_timeout 30s
in
/etc/php/7.4/fpm/pool.d/www.conf

File to update in GitHub…

You read my mind! I was just looking for it!

Did you already tried increasing the time out in:

In /etc/apache2/apache2.conf

Timeout 30

For request_terminate_timeout 30s
the default value is 0 and it means unlimited. So we think it is strange why it throws this issue.

Setup is Apache2 + Nginx + FPM + Mod event?

I didn’t. It was already 30.

cat /etc/apache2/apache2.conf  | grep Timeout
Timeout 30
KeepAliveTimeout 10
root@c02:/usr/local/hestia/bin# ./v-list-sys-services
./v-list-sys-services: line 298: lsb_release: command not found
NAME           STATE    CPU  MEM   UPTIME
----           -----    ---  ---   ------
apache2        running  0    473   4203
php-fpm        running  0    7     6336
nginx          running  0    93    27565
bind9          running  0.2  99    353
exim4          running  0    1     6335
dovecot        running  0    0     6335
clamav-daemon  running  0.7  1399  6335
spamassassin   running  0.9  340   6314
mariadb        running  0    580   6335
vsftpd         running  0    0     6335
cron           running  0    0     6335
ssh            running  0    3     6335
iptables       running  0    0     6335
fail2ban       running  1.2  205   2614

No idea about Mod event.

I use this machine only for DNS + Email

What is you max execution time on php? 60 sec? Make sure it is matched in the timeout of apache.

a2query -M

should show event / prefork

No it doesn’t.

root@c02:/usr/local/hestia/bin# a2query -M
event
root@c02:/etc/php/7.4/fpm# cat php.ini | grep execution
max_execution_time = 30

This is matched with apache “Timeout”

Event is fine “prefork” was the old method

1 Like

I started having trouble this morning again.

I have raised all limits to 60 seconds.

/etc/php/7.4/fpm/pool.d/www.conf

  • request_terminate_timeout 30 => 60s

/etc/apache2/apache2.conf

  • Timeout = 30 => 60

/etc/php/7.4/fpm/php.ini

  • max_execution_time = 30 => 60
  • memory_limit = 128M => 256M