• Resolved danbeach

    (@danbeach)


    Recently, we’ve been getting a lot (every 5 seconds or so)of PHP errors related to NS-Cloner. They all look like:

    Cron reschedule event error for hook: ns_cloner_cron, Error code: invalid_schedule, Error message: Event schedule does not exist., Data: {"schedule":"ns_cloner_cron_interval","args":[],"interval":120}

    I’m not exactly sure when they started, by guess is in the last couple of weeks, since either the 4.4.6 or 4.4.7 update. Is there something we can do to get rid of these?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Never Settle

    (@neversettle)

    Hello @danbeach

    The latest release that went out yesterday should not have the php notice. Please confirm

    Thread Starter danbeach

    (@danbeach)

    We are running the latest version (4.4.7) and continue to see the php errors.

    Following for updates, thanks.

    I’m also seeing this warning in the debug.log file after upgrading to the most recent NS Cloner version and WP 6.6.1.

    It seems that the NS Cloner’s register_interval() hook is not active when wp-cron.php calls wp_reschedule_event()

    Plugin Author Never Settle

    (@neversettle)

    Hello,

    We have pushed version 4.4.7.1 that fixes this issue. Thank you for your patience on this

    Sounds great!

    But according to my testing, this unfortunately doesn’t fix the issue. I still see the warnings in my debug.log file after installing v4.4.7.1 when the background cron jobs are running.

    It seems that the an extra check for wp_doing_cron() should be added to the $should_load variable in the __construct() method of the NS_Cloner class.

    If I manually add such a check, then I no longer see the warnings.

    Plugin Author Never Settle

    (@neversettle)

    Hello @keepmovingdk

    Which PHP version are you using? I have tested with PHP version from 7.x to 8.2 and there are no notices.

    The problem is not related to PHP version (I’m on PHP 8.2).

    The problem happens if using the built-in WP cron. You can manually trigger this by accessing this URL:
    http://<hostname>/wp-cron.php?doing_wp_cron

    Then you should (hopefully) see the warning in the debug.log file. But let me know if you don’t, then I’ll be happy to see if I can provide additional troubleshooting steps.

    Plugin Author Never Settle

    (@neversettle)

    Hello @keepmovingdk,

    I still cannot replicate this. The cron is instantiated once all plugins are active and enabled. If you can, try disabling other plugins and only using cloner to check if the notice appears. Alternatively if this is not possible, you can try on a different installation of WordPress.

    Thank you for your patience. I’m able to reproduce it on two different installations (one a local installation, the other our production site).

    The notice also appears with no other plugins active.

    I’m not sure why you are not able to reproduce it. Maybe because the wp-cron.php only causes the warning if there are active cron jobs ready for execution and if the ns_cloner_cron needs to be rescheduled.

    It’s correct that the cron is instantiated after plugins are active and enabled. But in the the __construct() method of the NS_Cloner class you have the following line 178:

    $should_load = is_admin() || ( wp_doing_ajax() && is_user_logged_in() ) || ( defined( 'WP_CLI' ) && WP_CLI ) || ns_is_signup_allowed();

    When wp-cron.php is being run in my environment, none of these conditions are true which leads to the warning.

    To fix this, the line could be changed to also check for wp_doing_cron():

    $should_load = is_admin() || ( wp_doing_ajax() && is_user_logged_in() ) || wp_doing_cron() || ( defined( 'WP_CLI' ) && WP_CLI ) || ns_is_signup_allowed();

    It’s fair enough if you don’t want to make this change unless other people also report the problem 🙂
    But I hope you find a way to reproduce it.

    Plugin Author Never Settle

    (@neversettle)

    Hey @keepmovingdk,

    Thanks for the assistance. Yes, this should fix the issue

    Great stuff @keepmovingdk !

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