1

Topic: Dashboard time out - 504 Gateway Time-out

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.1 OPENLDAP edition, Pro 4.6
- Deployed with iRedMail Easy or the downloadable installer? download
- Linux/BSD distribution name and version: ubuntu 18.04 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  LDAP
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

nginx log:
2021/08/20 10:09:33 [error] 1977#1977: *5188 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 69.24.27.132, server: _, request: "GET /iredadmin/dashboard HTTP/1.1", upstream: "uwsgi://127.0.0.1:7791", host: "server.domain.com",

syslog:
Aug 20 10:09:38 server iredadmin: Fri Aug 20 10:09:38 2021 - uwsgi_response_write_body_do(): Broken pipe [core/writer.c line 331] during GET /iredadmin/dashboard (69.24.27.132)
====

When logging into one of our 7 pro servers, I get a "504 Gateway Time-out". in my browser.  If I change from /dashboard to /domains or any other link on the server, the server functions 100% fine. CPU load, while trying to load the dashboard also spikes up.
There are around 220 domains on this server, with probably around 550 accounts. Is there a time-out I can increase? It does seem that the mysql process is where the CPU spike happens so I'm guessing it is something to do with the stats generated on the dashboard?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Dashboard time out - 504 Gateway Time-out

PaulCahill wrote:

Pro 4.6

There's a bug in iRedAdmin-Pro-LDAP old releases with Python 3 support, it did not correctly remove old SQL records in "amavisd" database. Sorry about this trouble.

Upgrading your iRedMail to the latest 1.4.0 and iRedAdmin-Pro-LDAP to 4.9 will fix the issue.

3 (edited by PaulCahill 2021-08-27 03:16:57)

Re: Dashboard time out - 504 Gateway Time-out

Thanks, upgrade plan in the near future, but for now I'm assuming it is these two tables:
select count(*) from maddr;
+----------+
| count(*) |
+----------+
|   413430 |
+----------+

MariaDB [amavisd]>  select count(*) from msgs;
+----------+
| count(*) |
+----------+
|   780977 |
+----------+

I ran cleanup_amavisd_db.py:
#  /usr/bin/python3 /opt/www/iredadmin/tools/cleanup_amavisd_db.py
* Backend: ldap
* SQL server: 127.0.0.1:3306
* Enable dirty read for querying without locking SQL tables.
* Delete quarantined mails which older than 7 days
* Delete incoming/outgoing emails which older than 3 days
*       [-] Deleting records: 1 - 100 (Thu Aug 26 15:14:10 2021)
* Delete unreferenced records from table `msgrcpt`.
* Delete unreferenced records from table `quarantine`.
* Delete unreferenced records from table `maddr`.
*       [-] Deleting records: 0 - 8 (Thu Aug 26 15:14:58 2021)
* Delete unreferenced records from table `mailaddr`.
*
* Remained records:
*
*       `msgs`: 781187
* `quarantine`: 0     
*      `maddr`: 413547
*   `mailaddr`: 0     
* Log cleanup status.

4

Re: Dashboard time out - 504 Gateway Time-out

PaulCahill wrote:

OPENLDAP edition, Pro 4.6

Old iRedAdmin-Pro releases has a bug in tools/cleanup_amavisd_db.py script, the recent releases fixed it. So please upgrade both iRedMail and iRedAdmin-Pro to get it fixed automatically.

5

Re: Dashboard time out - 504 Gateway Time-out

I get that it is fixed in a newer release. Is there something Ic an do to clean it up in the mean time though?

6

Re: Dashboard time out - 504 Gateway Time-out

PaulCahill wrote:

I get that it is fixed in a newer release. Is there something Ic an do to clean it up in the mean time though?

Just upgrade iRedAdmin-Pro please. smile
You can run the script "tools/cleanup_amavisd_db.py" manually after upgraded.