• Resolved brianbelley

    (@brianbelley)


    Hello,

    FYI, I attempted to update SVG Support to the latest version this morning, v2.5.13 from v2.5.8.

    It caused the following critical WordPress error, which took down the entire site showing the “There has been a critical error on this website” error:

    From PHP logs:

    [24-Feb-2025 13:21:17] WARNING: child 1921 said into stderr: “NOTICE: PHP message: PHP Fatal error: Allowed memory size of 402653184 bytes exhausted (tried to allocate 28672 bytes) in /wordpress/wp-includes/class-wpdb.php on line 2316”
    xxxxx – yyyyyyy 24/Feb/2025:13:20:55 +0000 “GET xxxxx.com/wp-admin/plugins.php” 500 /www/.wordpress/wp-admin/plugins.php – – 21593.219 392192 22.69%

    Note that as soon as I disabled SVG Support, the site functions perfectly fine again. Verified this occurs on both my local dev environment and my Staging server.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Benbodhi

    (@benbodhi)

    Hi there, thanks for sharing.

    I believe this may be due to one of the one time running functions in a recent update that clears duplicate meta from the database, and a memory limit too small in your hosting environments to handle it.

    I’ll try testing on smaller limits and reducing the batch sizing of the call. It was hard to create an efficient way to do this process unfortunately. But it should run quietly in the background.

    I’ll see what I can do to support lower memory limits and will update you here.

    Thread Starter brianbelley

    (@brianbelley)

    I believe we have a pretty sizeable memory limit – looks like 384MB on our hosting environment, and also on my local.

    Also, the fact that it gives me the critical error on my local machine (32GB RAM), leads me to think it isn’t a hardware resource issue.

    Server architecture Linux 6.1.100+ x86_64
    Web server Flywheel/5.1.0
    PHP version 8.2.27 (Supports 64bit values)
    PHP SAPI fpm-fcgi
    PHP max input variables 10000
    PHP time limit 180
    PHP memory limit 384M
    Max input time 60
    Upload max filesize 300M
    PHP post max size 300M
    cURL version 7.81.0 OpenSSL/3.0.2
    Is SUHOSIN installed? No
    Is the Imagick library available? Yes
    Are pretty permalinks supported? Yes
    .htaccess rules Custom rules have been added to your .htaccess file.
    Current time 2025-02-24T22:26:42+00:00
    Current UTC time Monday, 24-Feb-25 22:26:42 UTC
    Current Server time 2025-02-24T17:26:41-05:00

    loxlie

    (@loxlie)

    Hi there.

    Yes I’ve just had a huge site down for several hours due to the inefficient function bodhi_svgs_cleanup_duplicate_meta. Cycling through my 90000 posts 100 at a time. ??Not sure why there’s a meta value for all anyway when they all have a value of ‘0’.

    Anyway, had a chat with GPT and we came up with this vastly more efficient version that does it in one op:

    function bodhi_svgs_cleanup_duplicate_meta() 
    {
    global $wpdb;
    // Delete all but the latest
    inline_featured_image meta per post
    $wpdb->query("
    DELETE pm FROM {$wpdb->postmeta} pm
    JOIN (
    SELECT post_id, meta_id FROM (
    SELECT post_id, meta_id,
    ROW_NUMBER() OVER (PARTITION BY post_id ORDER BY meta_id DESC) AS row_num
    FROM {$wpdb->postmeta}
    WHERE meta_key = 'inline_featured_image'
    ) as duplicates
    WHERE row_num > 1
    ) to_delete ON pm.meta_id = to_delete.meta_id
    ");
    }

    Best wishes,

    Loxlie

    Plugin Author Benbodhi

    (@benbodhi)

    Yeah I found the issue and working on it. Will push update asap!

    Thanks for sharing this other solution too @loxlie

    Plugin Author Benbodhi

    (@benbodhi)

    Fix for this is implemented and tested. It will be pushed out in v 2.5.14

    Thanks so much for sharing, I was a dummy and used such an inefficient query in there.

    Plugin Author Benbodhi

    (@benbodhi)

    Ok update is out.

    Thanks for sharing this issue. I didn’t stumble upon it in my testing somehow so the wild query didn;t seem so wild until I reproduced and logged it out.

    Apologies for the downtime. Hopefully this fix cleans it all up.

    I also removed any entries where we don’t have the featured image inlining enabled. This was set to 0 after one was enabled then disabled, but should have just been removed.

    Updating to 2.5.14 should clean up on both accounts.

    Thread Starter brianbelley

    (@brianbelley)

    Thank you for the quick fix and turnaround!

    Updated to 2.5.14 and seems to be working fine. Thanks again!

    Plugin Author Benbodhi

    (@benbodhi)

    Thanks for your support and patience!

    Would be much appreciated if you could leave a review of the plugin when you have a moment.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.