• Resolved masbienblog

    (@masbienblog)


    Hi team,
    I’m encountering repeated database errors in my logs related to WooCommerce batch processing:

    [21-Jun-2025 16:31:39 UTC] WordPress database error Commands out of sync; you can’t run this command now for query SELECT a.action_id FROM wp_actionscheduler_actions a WHERE 1=1 AND a.hook=’wc_schedule_pending_batch_processes’ AND a.status IN (‘in-progress’, ‘pending’) LIMIT 0, 1 made by shutdown_action_hook, do_action(‘shutdown’), WP_Hook->do_action, WP_Hook->apply_filters, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->Automattic\WooCommerce\Internal\BatchProcessing{closure}, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->remove_or_retry_failed_processors, call_user_func, as_has_scheduled_action, ActionScheduler_Store->query_action, ActionScheduler_DBStore->query_actions
    [21-Jun-2025 16:31:39 UTC] WordPress database error Commands out of sync; you can’t run this command now for query SELECT option_value FROM wp_options WHERE option_name = ‘wc_pending_batch_processes’ LIMIT 1 made by shutdown_action_hook, do_action(‘shutdown’), WP_Hook->do_action, WP_Hook->apply_filters, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->Automattic\WooCommerce\Internal\BatchProcessing{closure}, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->remove_or_retry_failed_processors, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->get_enqueued_processors, get_option
    [21-Jun-2025 16:31:43 UTC] WordPress database error Commands out of sync; you can’t run this command now for query SELECT a.action_id FROM wp_actionscheduler_actions a WHERE 1=1 AND a.hook=’wc_schedule_pending_batch_processes’ AND a.status IN (‘in-progress’, ‘pending’) LIMIT 0, 1 made by shutdown_action_hook, do_action(‘shutdown’), WP_Hook->do_action, WP_Hook->apply_filters, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->Automattic\WooCommerce\Internal\BatchProcessing{closure}, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->remove_or_retry_failed_processors, call_user_func, as_has_scheduled_action, ActionScheduler_Store->query_action, ActionScheduler_DBStore->query_actions
    [21-Jun-2025 16:31:43 UTC] WordPress database error Commands out of sync; you can’t run this command now for query SELECT option_value FROM wp_options WHERE option_name = ‘wc_pending_batch_processes’ LIMIT 1 made by shutdown_action_hook, do_action(‘shutdown’), WP_Hook->do_action, WP_Hook->apply_filters, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->Automattic\WooCommerce\Internal\BatchProcessing{closure}, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->remove_or_retry_failed_processors, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->get_enqueued_processors, get_option

    It seems to be triggered during the shutdown_action_hook, and the error involves:

    • wc_schedule_pending_batch_processes
    • ActionScheduler_DBStore->query_actions

    I’m not using any custom hooks related to batch processing in my theme.
    I have ~8000 products and have disabled object cache (LiteSpeed), but the error persists.

    Any insights on what could be causing this or how to fully reset pending batch processes safely?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support LovingBro (woo-hc)

    (@lovingbro)

    Hi @masbienblog,

    I understand how concerning it can be to see repeated database errors like this in your logs, especially when you’re not using any custom batch processing code. You’ve already taken solid steps by checking your object caching and confirming no custom hooks are in play.

    These Commands out of sync errors usually point to a misalignment between the database connection and the Action Scheduler during shutdown. This is often triggered when there are lingering or stuck batch processes, especially with a high product volume like yours.

    To address this, here are a few steps you can take:

    1. Manually clear any pending or failed scheduled actions: Go to WooCommerce → Status → Scheduled Actions, then filter by:
    • Hook: wc_schedule_pending_batch_processes
    • Status: Pending and Failed

    If any are stuck, cancel or delete them.

    1. Reset batch process state: From the Tools tab in WooCommerce → Status → Tools, run:
    • Clear customer sessions
    • Clear transients
    • Delete orphaned variations (if applicable)
    • Rebuild the product lookup tables

    This helps ensure WooCommerce is not holding onto stale data that could be queuing processes unnecessarily.

    1. Manually clear the wc_pending_batch_processes option: If the error continues, you can reset the wc_pending_batch_processes option in your database manually using a tool like phpMyAdmin or WP-CLI. Alternatively, you could use a plugin like WP phpMyAdmin to run:
    DELETE FROM wp_options WHERE option_name = 'wc_pending_batch_processes';

    (Be sure to back up your database before running any direct queries.)

    Let us know once you’ve done this or if you’d like help reviewing your full System Status Report via https://pastebin.com. We’re here to help get this fully resolved!

    Thread Starter masbienblog

    (@masbienblog)

    I’ve already tried almost everything: cleaned the database, cleared transients and sessions, reviewed WooCommerce tools, and emptied abandoned carts. The only thing that made a noticeable difference was disabling the Woodmart theme and activating a different one — after that, CPU and memory usage dropped significantly.

    What I don’t understand is that even with just the main Woodmart theme activated (without the child theme and custom functions.php code), the issues still occur.

    At this point, I’m running out of options and not sure what else to try.

    Hi @masbienblog,

    Thanks for the update and the detailed testing!

    Since the issue goes away with a different theme, it strongly points to something in the Woodmart theme causing interference with WooCommerce’s batch processing or Action Scheduler.

    I recommend reaching out to Woodmart’s support to see if they’re aware of this or can suggest optimizations. In the meantime, you might try disabling specific Woodmart modules (like Ajax filters or product swatches) to see if performance improves further.

    Thank you. Let us know what you find out.

    Plugin Support Feten L. a11n

    (@fetenlakhal)

    Hi there,

    Since we haven’t heard back, I’ll mark this as resolved for now. We’re here if you need us!

    Apart from this, mind leaving a quick review? 😊 https://wordpress.org/support/plugin/woocommerce/reviews/#new-post

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Database error: wc_schedule_pending_batch_pr’ is closed to new replies.