Fixed High error count rates can cause unexpected performance issues for admincp home page

Xon

Well-known member
Affected version
2.1.9
XenForo checks serverErrorLogs to determine if it should display the "Server errors have been logged. You should review these." via a simple boolean check.

However this is implemented via calling;
PHP:
 $this->finder('XF:ErrorLog')->total()

The problem is this causes a SELECT COUNT(*) FROM xf_error_log to be run against the entire table. This requires locking, and if the error rate is high, then this can cause deadlocks and more errors.

A simple low-touch solution is the query which tests to see if there is anything in the table, which avoid table/index locking.

PHP:
(bool)\XF::db()->fetchOne('SELECT error_id FROM xf_error_log LIMIT 1')
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.1.10).

Change log:
Avoid table locking when checking if the error log table is populated
There may be a delay before changes are rolled out to the XenForo Community.
 
Top Bottom