• Resolved andrewnyc

    (@andrewnyc)


    This plugin has a major problem, perhaps with a recent update? I have had it installed for a while but made changes to settings recently. Last night I went to save the settings and my site crashed. Over two hours on the phone with my host’s tech support team revealed that this plugin starts to eat up massive amounts of CPU through PHP processes. I have a four core 4GB ram server and…each php process was taking up 85% of a core. The server was thrown offline for hours and we finally only discovered the problem by turning off plugins one by one. We repeated this twice and your plugin twice followed the same pattern of spiraling php processor usage which takes the server down completely. I had to disable the plugin, which is a shame since it was helping my page load speeds. Perhaps this is related to this thread as well – https://ww.wp.xz.cn/support/topic/503-server-error-when-enabling-plugin/? Please let me know if there are any particular settings that might be causing this? I was not using CSS or JS minify, but I was inlining some CSS and defering JS load.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Gabe Livan

    (@gabelivan)

    @andrewnyc thanks for raising this ticket! I’m sorry you had this experience. I know how frustrating it is to do debugging. Hopefully, this is an isolated case and perhaps there’s a conflict between plugins somewhere?

    I’m frankly surprised about what you’re saying since nothing like this ever reported (very high CPU usage and crashes as a result of too much usage) as far as I recall. After all, the purpose of the plugin is to help you reduce the page load and consistent efforts have been made to improve the PHP processing speed as it does matter a lot when you access a page that is not cached in any way.

    Last night I went to save the settings and my site crashed.

    Do you recall which new settings you’ve applied before you used the save settings button?

    We repeated this twice and your plugin twice followed the same pattern of spiralling php processor usage which takes the server down completely.

    Are you saying you only had Asset CleanUp enabled when you experienced this? Perhaps there’s a bad conflict with one of other optimisation plugins you might have used.

    Please let me know if there are any particular settings that might be causing this? I was not using CSS or JS minify, but I was inlining some CSS and defering JS load.

    The most common issue that was reported (and was not affected the CPU, but the memory in specific situations) was the /wp-content/cache/asset-cleanup/ directory which became filled with lots of GB and was difficult to clean up, going through each directory/file. Users had to do it manually from their cPanel (or whatever other ways to connect to their website they had, besides the Dashboard).

    Please send me your “System Info” from “Tools” (plugin’s menu) privately via https://gabelivan.com/contact/ (as it contains sensitive information).

    PS: I strongly recommend you to try New Relic performance monitoring tools (some hosting companies have it available for customers, free of charge, in their package). If there’s an issue with any plugin on your end, then this tool will tell you which file/function from the plugin is causing most of the loading delays.

    Thread Starter andrewnyc

    (@andrewnyc)

    Hi Gabriel,

    I had to disable the plugin entirely but I can try to turn it on quicky to retrieve the info file. I have had this plugin installed from when it was simpler, it seems that this has changed and been upgraded at some point. I recently started to make changes (from the end of last week) when Google started sending me mobile page speed warnings. I had W3 Total cache plugin and Asset Clean Up running for years together and this wasn’t an issue. I purchased Wp Rocket last week and kept Asset Clean Up active. However I noticed from this past weekend that my server was not responding and had to manually reboot it several times. Unfortunately WP rocket broke my site navigation so yesterday all I did was disable that plugin and enable W3 again. I was also on the Asset Clean up panel saving options, but I don’t remember exactly what. I noticed that with W3 total cache on that the css files that I want inlined are no longer inlined and I think I was just checking that. I hit save and it was spinning and spinning. Then I rebooted the server and nothing. The server was functional, but the plugin was taking so much PHP processing power that it could not accept and requests from visitors (503 error). So it’s a matter of resource usage spiraling out of control. This is a repeatable issue, and it happens with both WP Rocket and W3 Total Cache, so it’s not a conflict with those. Also, I have installed no new plugins and to the contrary have uninstalled plugins lately to try and slim things down.

    Plugin Author Gabe Livan

    (@gabelivan)

    @andrewnyc thanks for the extra info. If you have been using the plugin for such a long time, perhaps it wrote a lot (before the caching mechanism was as effective as it is now) of files to /wp-content/cache/asset-cleanup/. Can you check that, please? If you use cPanel, consider archiving the directory as a ZIP and see if you can download it (hopefully it’s not too large). I have a suspicion that you have lots of files there from the time when the current effective cleanup mechanism wasn’t implemented. It added up and ended up being so large that is gave you that delay you were mentioning about (the spinner showing up after you clicked save).

    PS: I’m very curious what’s the reason behind the issue you’ve been having. Please heck the error_log files as well that are likely reporting the exact PHP error you had in the background that led to the crashes. All I can promise is that it will get fixed immediately once I find more information about it.

    Thread Starter andrewnyc

    (@andrewnyc)

    Ok I emailed you the report

    Thread Starter andrewnyc

    (@andrewnyc)

    I checked /wp-content/cache/asset-cleanup/ in cpanel…it’s 4kb so not large at all. Could it have been cleared when I uninstalled and reinstalled the plugin? I will check the php error logs now

    Thread Starter andrewnyc

    (@andrewnyc)

    Where are the error logs found?

    Plugin Author Gabe Livan

    (@gabelivan)

    @andrewnyc you can create a file with the contents <?php phpinfo(); ?> (make sure it’s only you seeing the printed information as it contains sensitive data), you will find it there. It’s usually “error_log”. See this post for more details about its possible location: https://stackoverflow.com/questions/5127838/where-does-php-store-the-error-log-php5-apache-fastcgi-cpanel

    PS: There’s also a free plugin that captures the errors and prints them within the Dashboard (first page /wp-admin/) in a nice format called “Error Log Monitor”. You can set it up and future errors will be stored and printed by the plugin, no need to go through cPanel or other methods to retrieve the latest PHP errors).

    Thread Starter andrewnyc

    (@andrewnyc)

    Ok I will get that for you…I enabled the plugin for one minute to see if the error report was there and down my site went again. Error 524 “a timeout has occurred”

    Plugin Author Gabe Livan

    (@gabelivan)

    @andrewnyc thanks, looking forward to it. Another way to get the path to the log file is to use <?php echo ini_get('error_log'); ?>. Consider trying that too. If it shows it, please locate it in your cPanel or via SFTP and get the latest errors printed there. The past ones (not just the recent timeout) should be there too.

    PS: There’s a chance you might have had error logs turned off (not recommended). You can check that via <?php echo ini_get('log_errors'); ?>

    If they are turned off, you can use something like the following code to turn them on (in your wp-config.php file)

    <?php
    @ini_set('log_errors', 'On');
    @ini_set('error_log', '/tmp/php-errors.log'); // any accessible path you wish (make it harder to guess)
    ?>
    Thread Starter andrewnyc

    (@andrewnyc)

    I downloaded the PHP error log, the only error relating to your plugin is this:

    [24-Jan-2020 17:10:08 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/CombineCssImports.php on line 469
    [24-Jan-2020 04:16:01 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/CombineCssImports.php on line 469
    [24-Jan-2020 04:16:20 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/CombineCssImports.php on line 469
    [24-Jan-2020 04:17:01 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/CombineCssImports.php on line 469
    [24-Jan-2020 04:17:06 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/CombineCssImports.php on line 469
    [24-Jan-2020 04:17:22 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/CombineCssImports.php on line 469
    [24-Jan-2020 04:17:31 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/CombineCssImports.php on line 469
    [24-Jan-2020 04:17:35 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/CombineCssImports.php on line 469
    [24-Jan-2020 04:17:47 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/CombineCssImports.php on line 469
    [24-Jan-2020 04:17:57 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/CombineCssImports.php on line 469
    [24-Jan-2020 04:18:03 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/CombineCssImports.php on line 469

    I edited the path down. This error is repeated today, but oddly enough nothing last night when the server crashed or last weekend when I was also having problems. Perhaps because I restarted the server it didn’t write the error to the log?

    Plugin Author Gabe Livan

    (@gabelivan)

    @andrewnyc that’s what I needed! I’ll investigate line 469 from /classes/OptimiseAssets/CombineCssImports.php and everything connected to it until I will be sure to fix this. It could be a loop because of the way the @import is used in some of the CSS files you’re loading.

    As far as I recall, I had timeout errors when I’ve been testing combining CSS imports with wrong @import data used. I experienced delays, but not the ones you mentioned (crashing the server). If you’re inlining CSS, then you might have something inside the syntax (a path taking too long to load, a relative path using ../ that was incorrectly added and PHP is confused when it deals with it, like keep trying to find it until the timeout occurs, .etc). I’ll analyse the CSS files from your website and give you an update soon. All I can promise is that this issue will be fixed for you and I will do my best to fix in such a way that no other website will experience the same issue, no matter how wrong the CSS syntax is.

    PS: If you disable CSS inlining/minifying/combining, you should get the error anymore and you could use the plugin with the other features (e.g. unloaded CSS/JS files) enabled until I will fix this.

    Thread Starter andrewnyc

    (@andrewnyc)

    OK thanks I will try disabling the CSS inlining feature. FYI, that was something that I was not using before last weekend, so perhaps that’s why I never had this issue before. I don’t understand why the error log shows nothing for last night and also for last weekend.

    Thread Starter andrewnyc

    (@andrewnyc)

    Bad news…even with CSS inlining disabled it started the same problem. I had to reboot the server again to disable it completely

    Plugin Author Gabe Livan

    (@gabelivan)

    @andrewnyc

    FYI, that was something that I was not using before last weekend, so perhaps that’s why I never had this issue before.

    That’s obviously the reason because you most likely have @import within those files. The code is meant to skip past any further checking if there is no @import there.

    I don’t understand why the error log shows nothing for last night and also for last weekend.

    You either had the logging of the errors turned off (not likely, but you never know), or (as I’ve noticed it in many cases), or the previous error logs got archived as ZIP/GZ files and you can only view the latest (X) number of errors from an active .log file. Some hosting packages have this configuration as it’s also easier for you to scroll through the latest errors (you likely don’t want to have very old errors that are not relevant anymore in the same file, which could turn up very large and harder to read).

    Plugin Author Gabe Livan

    (@gabelivan)

    @andrewnyc good news at last! I found the culprit. It’s the way the child theme imports content from the parent theme which is incorrect (which keeps using @import on its own file) and results in an endless loop as the PHP script keeps finding new @import to read from. I can share with you more information via email if you’re interested since you might want to keep your website’s details private.

    A fix will be released as soon as possible. You’ll be updated!

Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘Plugin crashes website and uses massive CPU power for PHP’ is closed to new replies.