Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


UNSOLVED Wordpress (unmanaged) CRON interrupts product loading


  • Hello,

    I have very unusual and frustrating behavior. I have Wordpress (unmanaged) App, with Woocommerce and WMPL plugins.

    In WooCommerce Products page, when I switch to different language, or I go to next product page, sometime products are not loaded. This behavior happens after CRON (Run cron job) appears in LOG. Few refreshes or switching back to default English language fixes it. But after 1 min. CRON job is repeated and products disappear again.

    All unnecessary plugins turned off, same behavior in default Storefron theme. When using website in LAMP app, everything seems to be working.

    Any suggestions would be appreciated.

    cron.PNG

  • Staff

    @DeiWee Have you set up the WP cron job when you set it up in the LAMP app?

  • Staff

    I suspect maybe part of the issue is that the WP developer edition runs cron quite aggressively. Once every minute. I am trying to remember why we have a discrepancy between the cron interval of WP developer (1min) and WP managed (5 mins).

    Does anyone know what is the "ideal" value here?


  • @girish For what it's worth, the Cloudron docs themselves link to this page: https://www.lucasrolff.com/wordpress/why-wp-cron-sucks/

    And on that page it mentions about disabling the WP-cron as you did and then create a real Cron Job to run that script every 5 minutes or so, it also lists other times like 10 minuets or so. I suspect that is where you got the every "5 minutes" from.

    Not sure why it's every minute, but generally speaking I wouldn't think that'd be a big deal anyways, as long as hosting and resources are sufficient I wouldn't expect it to have a negative impact unless the stuff in WP-cron was modified later via plugins to be much more intensive.

    Probably would be fine to change it to run every 5 minutes. My two cents anyways. Would be nice if this was configurable though, I guess it's not because it's set in the package build process, right?

    Update: Apparently Kinsta has an article stating they run it every 15 minutes by default: https://kinsta.com/knowledgebase/disable-wp-cron/#schedule-system-cron


  • @girish said in Wordpress (unmanaged) CRON interrupts product loading:

    I suspect maybe part of the issue is that the WP developer edition runs cron quite aggressively. Once every minute. I am trying to remember why we have a discrepancy between the cron interval of WP developer (1min) and WP managed (5 mins).

    Does anyone know what is the "ideal" value here?

    Yes, it was me a year ago who requested it because WP has 1 minute cron jobs and they fail if you set it to 5 minutes.

  • Staff

    @imc67 You mean WP has some built-in cron jobs that require 1min interval? I couldn't find information about this, do you have any? I either need to fixed Managed WP or Developer WP accordingly.


  • @imc67 Curious why Kinsta which is huge can get away with it at 15 minutes by default though... very strange. You'd think they'd have a whole bunch of customers having issues if that was their default and didn't work with WordPress well.


  • @girish said in Wordpress (unmanaged) CRON interrupts product loading:

    @imc67 You mean WP has some built-in cron jobs that require 1min interval? I couldn't find information about this, do you have any? I either need to fixed Managed WP or Developer WP accordingly.

    If you set it to 5 then WP site check is complaining that there are missed events. Because either WP or plugins can create 1 minute tasks.

  • Staff

    @imc67 said in Wordpress (unmanaged) CRON interrupts product loading:

    If you set it to 5 then WP site check is complaining that there are missed events. Because either WP or plugins can create 1 minute tasks.

    Ah ok, I think that can be worked around. I have noticed that if you install WP (both versions) and immediately click on the "Enable autoupdates" for a plugin, it will complain about cron not running. But it goes away after the first cron run. So, the workaround is maybe to run cron on package start up (have to try).


  • @girish said in Wordpress (unmanaged) CRON interrupts product loading:

    @imc67 said in Wordpress (unmanaged) CRON interrupts product loading:

    If you set it to 5 then WP site check is complaining that there are missed events. Because either WP or plugins can create 1 minute tasks.

    Ah ok, I think that can be worked around. I have noticed that if you install WP (both versions) and immediately click on the "Enable autoupdates" for a plugin, it will complain about cron not running. But it goes away after the first cron run. So, the workaround is maybe to run cron on package start up (have to try).

    I don’t use autoupdates on my WP sites.

    This cron task is running every minute:

    ActionScheduler_QueueRunner->run()


  • @d19dotca said in Wordpress (unmanaged) CRON interrupts product loading:

    @imc67 Curious why Kinsta which is huge can get away with it at 15 minutes by default though... very strange. You'd think they'd have a whole bunch of customers having issues if that was their default and didn't work with WordPress well.

    Did I remember correctly that you also use MainWP? I’m also a happy user and look there at the cron tasks there are at least 3 that run every minute.


  • @imc67 Yeah I use MainWP, haven't noticed any issues though and that's running in the Managed version where the cron is every 5 minutes I believe. Where might I check that part in MainWP?


    Update: Just checked, I see only one that runs every minute, the others are much longer runs.

    8abbae7d-c143-4ab3-8aed-68348d7d708b-image.png

    Of course now that I look at it, the Last Run time for the one that runs every minute was yesterday, so that's a bit strange. haha. But I've never noticed any functionality issues or anything like that so far.


  • @girish No, I did not. I created LAMP app, migrated site and tested if products keep disappearing. When products was working I notice CRON difference in logs.


  • Maybe it is possible to increase CRON time from 1 minute? I tried to change it with WP CRON plugin, but with no success.

    list.PNG

    I will try to investigate more with LAMP and custom CRON timing, maybe this is a mix of things with WPML as well.

  • Staff

    @DeiWee Thanks, the 1 min cron is hardcoded in the package source code. https://git.cloudron.io/cloudron/wordpress-developer-app/-/blob/master/CloudronManifest.json#L26 . I am looking into what the ideal duration is in the meantime.


  • Had a quick thought here... if the issue originally reported is truly caused by the cron job... well that cron job is going to run anyways right? So in other words maybe by decreasing the frequency of the cron we decrease the frequency of the issue reported, but the issue reported still in fact remains. Right? Or am I misunderstanding?

    Almost seems like either A) the cron isn't related to this issue or B) there is something else that needs to get fixed (possibly at the plugin level) that isn't playing nicely with the cron / something environmental.

  • Staff

    @d19dotca said in Wordpress (unmanaged) CRON interrupts product loading:

    Or am I misunderstanding?

    You are not misunderstanding. We sort of went off on a tangent to understand the cron situation better. The real cause of the original issue, we don't know yet.

    @DeiWee If this is a setup you are OK with helping us debug, can you please contact us at support@cloudron.io ? You can just make a clone of the app and we can try to figure out what's happening to make the page stall.


  • @imc67 said in Wordpress (unmanaged) CRON interrupts product loading:

    If you set it to 5 then WP site check is complaining that there are missed events. Because either WP or plugins can create 1 minute tasks.

    Yes, cron scheduled Wordpress can be scheduled down to the minute. But they're expected to be missed. The default WP-Cron interval is "whenever the next person visits the site, run all the scheduled events that are in the past and haven't been run" (the one that Cloudron rightfully uses the WP-CLI and disables the native WP-Cron). That's pretty horrible, but that's what Wordpress installs expect the environment to be at default. So, the WP Site Check says that's notable, that wp-crons don't get run at the minute they're specified?

    If the WP Health Status Page actually says that, then Wordpress devs clearly think 1 minute (or a hugely popular site) is the best interval.