Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rocket_rucss_pending_jobs_cron flooding actionscheduler_actions #4940

Closed
4 tasks
jcatello opened this issue Apr 17, 2022 · 45 comments · Fixed by #4945
Closed
4 tasks

rocket_rucss_pending_jobs_cron flooding actionscheduler_actions #4940

jcatello opened this issue Apr 17, 2022 · 45 comments · Fixed by #4945
Labels
module: remove unused css needs: grooming priority: high Issues which should be resolved as quickly as possible type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Milestone

Comments

@jcatello
Copy link

Before submitting an issue please check that you’ve completed the following steps:
Version: 3.11.0.4

Describe the bug
The database table actionscheduler_actions is being overwhelmed with Completed tasks from rocket_rucss_pending_jobs_cron

  5 rank_math/analytics/daily_tasks
  6 wpforms_admin_addons_cache_update
  6 wpforms_admin_builder_templates_cache_update
 21 wpforms_admin_notifications_update
 32 action_scheduler/migration_hook

1439 wpar/process_health_check
2830 wc_facebook_regenerate_feed
16005 wpar/global_republish_fetch_posts
36503 rocket_rucss_job_check_status
12401212 rocket_rucss_pending_jobs_cron

Of those only

6380 rocket_rucss_pending_jobs_cron

are set to pending.

The wp cron is working properly so if there is some task to clear these out often it doesn't seem to be working but database table grew to over 8GB.

Expected behavior
Some scheduled job to clear these completed tasks.

Backlog Grooming (for WP Media dev team use only)

  • Reproduce the problem
  • Identify the root cause
  • Scope a solution
  • Estimate the effort
@piotrbak piotrbak added the type: enhancement Improvements that slightly enhance existing functionality and are fast to implement label Apr 18, 2022
@piotrbak
Copy link
Contributor

Hello @jcatello and thank you for creating the issue. You can use the following filter to force Action Scheduler to remove its log more frequently:

add_filter( 'action_scheduler_retention_period', function( $seconds ){
    return n * DAY_IN_SECONDS;
} );

The n should be replaced by the number of days we want the log to be cleared after. Important note is that this snippet is affecting action scheduler logs for all tasks from different plugins.

@piotrbak piotrbak added priority: high Issues which should be resolved as quickly as possible module: remove unused css needs: grooming labels Apr 18, 2022
@piotrbak
Copy link
Contributor

piotrbak commented Apr 18, 2022

The permanent solution here would be to:

  1. Not to log our actions
  2. Manipulate the AS filter to clear the logs more frequently
  3. Create our own cleaner class

@umviajante
Copy link

Hi guys... I don't know if this is the right place to ask this. I'm not a programmer, just a WP Rocket user...

When accessing Scheduled Actions I saw a huge number of actions that keep growing... they are successfully completed, but they don't stop every minute...

Along with that, I have another observation...

When I upgrade from Version 3.10.9 to 3.11.0.4 , an alert exists with the following message:

WP Rocket: We detected missing database table related to Action Scheduler. Please visit the following URL to recreate it, as it is needed for WP Rocket to work correctly.

When I click on the LINK, I access the Scheduled Actions and see the giant number of actions. And it seems that nothing solves the alert... maybe because this queue is eternal.

If I keep the plugin at the latest version 3.11.0.4.... after a few hours (maybe by the cache) I start to have 504 errors in several places... (both on the website and in the wp control panel) and from what I found it is an error caused by a problem in the database.

The only thing I can guess is that the database issue is caused by this issue presented in the WP Rocket alert.

To avoid errors on the site I went back to version 3.10.9. This makes the alert disappear and the site no longer displays the 504 error... but the list in Scheduled Actions continues infinite....

Sorry to say too much... but I tried to report exactly what is happening here....

@piotrbak
Copy link
Contributor

@umviajante This alert is correct when Action Scheduler wasn't able to create its tables correctly. They should be recreated while accessing the mentioned link. If that's not happening, could you reach me directly at piotr [at] wp-media.me and send me FTP/WP Admin access to your site? We'd like to investigate why it's not happening in your case.

@alfonso100
Copy link
Contributor

@vmanthos
Copy link
Contributor

@viobru
Copy link
Contributor

viobru commented Apr 21, 2022

@DahmaniAdame
Copy link
Contributor

@jcatello
Copy link
Author

Looks like this is causing fatal errors now, upgrading to 3.11.05

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to WP_Rocket\Event_Management\Event_Manager::add_subscriber() must implement interface WP_Rocket\Event_Management\Subscriber_Interface, string given, called in /home/healthfu1/public_html/wp-content/plugins/wp-rocket/inc/Plugin.php on line 115 and defined in /home/healthfu1/public_html/wp-content/plugins/wp-rocket/inc/classes/event-management/class-event-manager.php:33
Stack trace:
#0 /home/healthfu1/public_html/wp-content/plugins/wp-rocket/inc/Plugin.php(115): WP_Rocket\Event_Management\Event_Manager->add_subscriber('WP_Rocket\\Engin...')
#1 /home/healthfu1/public_html/wp-content/plugins/wp-rocket/inc/main.php(50): WP_Rocket\Plugin->load()
#2 /home/healthfu1/public_html/wp-includes/class-wp-hook.php(307): rocket_init('')
#3 /home/healthfu1/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#4 /home/healthfu1/public_html/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
#5 /home/healthfu1/public_html/wp-settings.php(450): do_action('p in /home/healthfu1/public_html/wp-content/plugins/wp-rocket/inc/classes/event-management/class-event-manager.php on line 33

@piotrbak
Copy link
Contributor

piotrbak commented Apr 21, 2022 via email

@jcatello
Copy link
Author

Correct, rolling back to 3.11.04 resolved it

@piotrbak
Copy link
Contributor

Could you send me WP/SFTP access to affected website? piotr [at] wp-media.me

We can use https://onetimesecret.com for that.

@jcatello
Copy link
Author

Sent

@basslion
Copy link

I am a WP Rocket user and i did experience the wp_actionscheduler table growing quite fast in our DB. We currently have limits on our size of our DB at 1000mg by our host. I was sent a fix that was to be put in the functions.php of our child theme that would clear the table every 24hrs, however it still managed to exceed this in the 24hrs. Also due to this, our CPU usage has skyrocketed and we are going to be throttled as a result and limitations to our website are going to be implemented. I think this was prematurely rolled out and shared hosting was not taken into consideration prior to roll out.

@piotrbak
Copy link
Contributor

@basslion Our apologies for the troubles you're dealing with. Root cause is, unfortunately, not related to WP Rocket itself, but to the very popular 3rd-party, Action Scheduler:
woocommerce/action-scheduler#698

In 3.11.0.5 we made sure to improve a couple of scenarios related to AS, including the one mentioned in the issue.

@piotrbak
Copy link
Contributor

@jcatello I'm closing this issue. Fix for it was introduced in 3.11.0.5, the enhancement of this fix will be present in, most likely, 3.11.1.

You can monitor it here:
#4960

@basslion
Copy link

basslion commented Apr 23, 2022

This issue still seems to be happening although not as bad, but for our site and hosting which is limited to 1000mb for DB, it is still causing problems. I see these rocket_rucss_job_check_status hooks repeating non stop https://prnt.sc/GB9GH-lfW3V2

Pages and pages of them, 2,900 pages of 100 lines to be exact as I type this comment.

I have applied the update, however I still have the quick fix supplied by WP Rocket where I was to add a line of code to functions.php of our child theme. Should I remove the following because it may be conflicting with what the update is doing?

add_filter( 'action_scheduler_retention_period', function( $seconds ){
return 86400;
} );

HELP!!!!!!

@piotrbak
Copy link
Contributor

@basslion rocket_rucss_job_check_status is not related to this issue. WP Rocket is set to remove up to 6000 rocket_rucss_job_check_status completed entries per hour since 3.11.0.5.

Please remove the mentioned filter and the number will start decreasing (you can also just remove those actions manually, which will be a faster solution). If you need any further help, please reach our support.

@worldwildweb
Copy link
Contributor

@piotrbak piotrbak added this to the 3.11.1 milestone May 2, 2022
@Rodrihead
Copy link

Hi everyone.

The problem is related to the "Removed unused CSS (beta)" option.
You have to disable it in order to fix the number of scheduler actions.

I hope WP Rocket fixes it on the next release.
Regards.

@juricazuanovic
Copy link
Contributor

@cspcreative
Copy link

I'm experiencing this issue as well. I am on the latest version of WP Rocket. I've even uninstalled WP Rocket, deactivated WooCommerce, and for some reason my Scheduled actions are still flooding with:

rocket_rucss_pending_jobs_cron | Complete |  Every 1 minute | 2022-06-24 17:13:18 +0000(7 minutes 42 seconds ago) | 2022-06-24 17:12:18 +0000 action created 2022-06-24 17:13:24 +0000 action started via WP Cron2022-06-24 17:13:24 +0000 action complete via WP Cron

Any intermediate fixes for this? My DB grows huge very quickly. I first stumbled across this because my Host Kinsta said I had gone over the 10GB disk usage and I ended up looking at the MySQL DB and seeing the actionscheduler_actions and _logs tables were gigantic.

@jcatello
Copy link
Author

Yeah it's a nightmare :(

Do you have access to SSH / WP CLI:

To collect some information, this will print out all current hooks and what status they are in.

wp db query "select status from $(wp config get table_prefix)actionscheduler_actions; " | sort | uniq -c | sort -n

You will most likely see something like..

12 rocket_rucss_pending_jobs_cron failed
358 rank_math/analytics/get_inspections_data complete
494 rocket_rucss_pending_jobs_cron pending
1957536 rocket_rucss_pending_jobs_cron complete

We've just been clearing out all complete/failed tasks

Clear out completed / failed tasks:

wp db query "delete from $(wp config get table_prefix)actionscheduler_actions where status = 'failed' or status = 'complete'; "

I would also truncate the logs table:

wp db query "truncate $(wp config get table_prefix)actionscheduler_logs;"

finish up with a DB optimize:

wp db optimize

If you notice the database tables are still really large, sometimes an optimize doesn't fix it so you will want to dump the table, drop it, then import the table which will free up any unnecessary space.

@piotrbak
Copy link
Contributor

@jcatello @cspcreative thanks for posting. Have you already contacted our Support Team telling that the problem is still there?

It should be fixed in the #4960 so checking why it still appears would be valueable.

@akram-Qbh
Copy link

I'm having the same problem with the latest version

@datajake-hill
Copy link

image

Upgraded to 3.12 and I'm also having this issue.

@jamiematrix
Copy link

Highly recommend getting in contact with WP Rocket support!

@akram-Qbh
Copy link

Who faced this problem and managed to solve it?

@akram-Qbh
Copy link

image

Upgraded to 3.12 and I'm also having this issue.

hi did you manage to solve it

@jcatello
Copy link
Author

Just recreate the table manually is the fastest approach:

woocommerce/woocommerce#25895 (comment)

@akram-Qbh
Copy link

Just recreate the table manually is the fastest approach:

woocommerce/woocommerce#25895 (comment)

I added it but it didn't solve the problem
image

@akram-Qbh
Copy link

image

@socialpreneur
Copy link

socialpreneur commented Sep 19, 2022

Is this really a closed issue? I'm seeing "WP Rocket: We detected missing database table related to Action Scheduler. Please visit the following URLto recreate it, as it is needed for WP Rocket to work correctly." on the latest version.

This happens without using RUCSS.

@AriGolden
Copy link

Is this really a closed issue? I'm seeing "WP Rocket: We detected missing database table related to Action Scheduler. Please visit the following URLto recreate it, as it is needed for WP Rocket to work correctly." on the latest version.

This happens without using RUCSS.

Same problem here since version 3.12.1.

@Daniel-HBK
Copy link

Same problem here!

@piotrbak
Copy link
Contributor

@socialpreneur @AriGolden this issue was resolved in 3.12.1.1, apologies for the troubles.

@Daniel-HBK Which issue are you reffering to? This specific thread is strictly related to rocket_rucss_pending_jobs_cron actions inside the pending or complete state in Action Scheduler tables.

@Daniel-HBK
Copy link

@piotrbak I have a diff one but the same flood issue.
rocket_preload_job_preload_url

image

image

@piotrbak
Copy link
Contributor

@Daniel-HBK Updating to 3.12.1.1 will solve the problem. If you still don't have access to it (it's a staggered release), please reach our Support and we'll make it available for you.

@DahmaniAdame
Copy link
Contributor

Related - https://secure.helpscout.net/conversation/2039490566/375237/
400k+ failed entries for rocket_rucss_job_check_status in just 2 days.
Cleared the failed processes. Asked the customer to set up a server-side CRON and we go from there.

@MyGodKnow
Copy link

So, how to solve this problem?

@piotrbak
Copy link
Contributor

piotrbak commented Jan 9, 2023

@MyGodKnow Hello and thanks for the comment. This problem should be solved already, if you are still experiencing it, please reach our Support Team for further investigation.

@mcneese
Copy link

mcneese commented Jan 26, 2023

@piotrbak i'm having the same exact problem as #4940 (comment) I've uninstalled and removed WP Rocket and i'm still getting a flood of rocket_rucss_pending_jobs_cron items. What's the solution for those of us that have already removed WP Rocket? Clarification: woocommerce has never been installed on this site.

@piotrbak
Copy link
Contributor

@mcneese Could you reach our Support, so we could investigate why it's happening?

@MyGodKnow
Copy link

@MyGodKnow Hello and thanks for the comment. This problem should be solved already, if you are still experiencing it, please reach our Support Team for further investigation.

Yes, I upgraded WP-Rocket to the new version and solve thie problem. Thanks you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: remove unused css needs: grooming priority: high Issues which should be resolved as quickly as possible type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Projects
None yet
Development

Successfully merging a pull request may close this issue.