• Resolved altstack

    (@altstack)


    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ajay

    (@ajay)

    @altstack

    There is a bug in the caching – thank you for flagging this. I’ve filed an issue in GitHub and will fix it for the next release.

    Separately, if you’d like, you can try this beta version of the plugin? I’ve been working on several query improvements which should help significantly. Doesn’t have the cache fix yet.

    https://github.com/WebberZone/top-10/releases/tag/v4.5.0-beta2

    I’m also planning to release 4.5.0 over the weekend, ideally.

    Plugin Author Ajay

    (@ajay)

    @altstack

    I pushed a beta that should fix the cache issue as well: https://github.com/WebberZone/top-10/releases/tag/v4.5.0-beta3

    Thread Starter altstack

    (@altstack)

    Thank you for the quick follow-up and for making beta3 available.

    I have now taken a look at both 4.5.0-beta2 and beta3. It appears that adjustments have been made to both the queries and the related cache handling. Thank you for looking into this and updating the beta so quickly.

    When I have some time, I’ll take a closer look at the code and try beta3 in a staging environment. I’ll also keep an eye on how concurrent cache regeneration behaves after the cache is cleared.

    Thank you again for your helpful responses and for continuing to develop and maintain Top 10. I have tried several similar plugins, but I have continued to use Top 10 because it is lightweight, flexible, and easy to manage in day-to-day use. I genuinely appreciate the work you put into it.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.