- Edited
Since some days, we experience issues with long timeouts when browsing on the osticket frontend (1-2minutes). together with the timeouts, the ticket counts disappears from the menu. top level ticket count is disabled.
during that, the server runs 100% CPU on all cores for the "SELECT COUNT(DISTINCT..." queries which we think count the tickets in each queue. sometimes multiple of these queries run parallel and run from 45 to 200 seconds.
after a lot of try and error with figuring out which search criteria in which queue might cause these issues, we found out that it is probably caused by fields from custom forms.
When there is a custom form involved a LEFT JOIN to ost_form_entry_values is added to the count query like this:
LEFT JOIN ost_form_entry_values B2 ON (B1.id = B2.entry_id)
As long as there is only one of those the query runs fine in < 1s.
We couldn't figure out when exactly but sometimes a new queue or a new criteria in a queue adds the same LEFT JOIN again and just names it differently until we end up with something like this:
LEFT JOIN ost_form_entry_values B2 ON ( B1.id = B2.entry_id)
LEFT JOIN ost_form_entry_values B3 ON ( B1.id = B3.entry_id)
LEFT JOIN ost_form_entry_values B4 ON ( B1.id = B4.entry_id)
With 2 of those the query runs for about 3s and with 3 it starts to become unusable with about 120s. If we manually remove those additional joins and rename the referenced fields the query again runs in under 1s.
As a reference I attached full queries with the slow one running over 120s and the "fast" one 3s. I wasn't allowed to upload text files, so PDF it is
CentOs 7
osticket version: 1.12.2
php 7.3.10
MariaDb 10.3.18
Probably similar issue as here: https://forum.osticket.com/d/95235-slow-staff-login-after-adding-ticket-queue