504 Gateway Time-out Err

My Mautic version is: 4.1.2
My PHP version is: 7.4.27
My Database type and version is: mysql 5.7.35-38-log (mysql) Percona Server

My problem is: Everytime I login I get a 504 gateway timeout issue

These errors are showing in the log: I don’t see any in mautic… but I do see this slow query in the database:

Time: 2022-02-15T00:34:16.422342Z

Schema: mauticdbtwo Last_errno: 0 Killed: 0

Query_time: 10.900411 Lock_time: 0.000243 Rows_sent: 4 Rows_examined: 1608254 Rows_affected: 0 Bytes_sent: 1112

SET timestamp=1644885256;
SELECT ll.event_id,
e.name AS event_name,
e.description AS event_description,
c.name AS campaign_name,
c.description AS campaign_description,
CONCAT(CONCAT(l.firstname, ’ '), l.lastname) AS lead_name FROM campaign_lead_event_log ll LEFT JOIN campaign_events e ON e.id = ll.event_id LEFT JOIN campaigns c ON c.id = e.campaign_id LEFT JOIN leads l ON l.id = ll.lead_id WHERE (ll.is_scheduled = 1) AND (e.type = ‘email.send’) ORDER BY ll.trigger_date ASC LIMIT 4;

Steps I have tried to fix the problem: I have increase timeout on nginx and php-fpm… but honestly this does not seem like any solution … it is just slow on the first load.

Did you create a custom dashboard with a query on a custom field?

You should try to login and then go here
https://domain.com/s/contacts Which is the direct link to the contacts.
See if this loads, if yes, then you have an issue with the dashboard.

You can then try to remove the widgets on the dashboard via the database, so you can access the dashboard normally.

The above assumes you can get to the contacts link.

/s/contacts loads fast. So it is something with the dashboard. I don’t remember creating a custom dash but I have had mautic since 2.x version so that is a possibility.

I went ahead and cut down my widgets to only 5 on dashboard:

  • Contacts Created
  • Emails Sent opened
  • Ignored opened emails
  • upcoming emails
  • top lists

But the 504 error persists.

Even if its an issue with too many widgets why can’t Mautic load the dashboard asynchronous to alleviate these timeout issues?

@rankinit In the past our issue was a custom field which we then removed or changed which was part of the reporting on the dashboard. This caused an issue when these were removed, ie the fields.

I would suggest you remove all widgets.

With regards to the loading, submit an issue on Github.