Database connection issue after clearing the Top 10 cache
-
Hello,
I am reporting a database connection failure that appears to be related to the daily popular-post query generated by the Top 10 plugin.
Environment:
- WebberZone Top 10: 4.4.3
- WordPress: 7.1
- Single-site installation
Recently, I used “Clear cache” on the Top 10 Tools page.
Shortly afterward, the entire site began returning database connection errors. Database activity records from the incident showed that the number of stalled connections had reached the server-side limit of 100.
All of the stalled SQL statements that could be identified had the following general form:
SELECT wp_posts.*,
wp_top_ten_daily.postnumber,
SUM(wp_top_ten_daily.cntaccess) AS visits,
…The complete SQL statement was not available.
I temporarily stopped dynamic WordPress requests and switched the site to a static maintenance page. The site subsequently recovered.
There was also an increase in incoming traffic during the incident. However, I cannot determine whether the traffic increase was the initial cause or whether it merely amplified an existing query backlog.
As far as I can remember, I have rarely, if ever, used the Top 10 cache-clear function before. Given the timing and the repeated execution of the same daily aggregation query, I wonder whether clearing the cache may have triggered a cache-stampede-like situation, with multiple requests executing the same query concurrently.
I would appreciate your thoughts on whether this is a plausible explanation.
I also reviewed the version 4.4.3 code and noticed the following:
Cache::get_key()appears to return a cache key consisting only of an MD5 hash.Cache::get_widget_keys()searches for transients whose names begin with_transient_tptn_.
Is the “Clear cache” operation also intended to delete the current transients that use MD5-based keys?
I would also appreciate any information about whether popular-post cache regeneration currently includes locking or single-flight protection to prevent duplicate execution of the same query, and whether any related changes are planned.
Thank you.
You must be logged in to reply to this topic.