• Resolved emree

    (@emree)


    Hi, my website has too many these errors in debug.log . I guess it’s related to some triggering by “shutdown” event from the woocommerce.

    https://ww.wp.xz.cn/plugins/woocommerce-legacy-rest-api/ is enabled in my website.

    HPOS is never enabled.

    Hosting package has 4 GB Ram support.

    I’m using Woodmart, Jetpack, Facebook for Woocommerce, Google for Woocommerce, Product Feed PRO for WooCommerce.

    Sample errors:

    ‘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 [27-Dec-2025 23:18:07 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

    I fixed it with that but but I’m not too sure about it.

    add_action(‘init’, function () { remove_action( ‘shutdown’, [ Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController::class, ‘shutdown’ ] ); });



    Woocommerce report:

    https://limewire.com/d/EPfHT#iD9TvDmP5T
    • This topic was modified 5 months, 2 weeks ago by emree.
    • This topic was modified 5 months, 2 weeks ago by emree.
    • This topic was modified 5 months, 2 weeks ago by emree.
    • This topic was modified 5 months, 2 weeks ago by emree.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @emree,

    Thanks for the very detailed report, which helped a lot.

    The error you’re seeing, “Commands out of sync; you can’t run this command now”, is coming from WooCommerce’s Batch Processing system when it runs its cleanup logic on the shutdown hook.

    This is not related to HPOS (it’s disabled on your site), and it’s not a memory or RAM issue. What’s happening is:

    • WooCommerce runs a batch cleanup on shutdown
    • At that moment, another plugin has already opened a database query and not fully closed it
    • MariaDB (especially on LiteSpeed) does not allow a second query on the same connection
    • MySQL then throws the “commands out of sync” error

    This commonly occurs on sites with heavy Action Scheduler usage, feed/sync plugins, and MariaDB + caching layers.

    You mentioned removing the WooCommerce batch shutdown handler. While this does suppress the error, we don’t recommend keeping this in place.

    That shutdown handler is responsible for:
    • Cleaning up failed batch processors
    • Retrying stalled jobs
    • Preventing orphaned background tasks

    Removing it can cause stuck jobs and data inconsistencies over time, so it should only be used temporarily for debugging.

    Recommended next steps

    1. Clean up Action Scheduler
      From WooCommerce → Status → Scheduled Actions:
      • Bulk delete failed actions
      • Allow pending actions to complete

    If you have WP-CLI access, you can also run:
    wp action-scheduler clean –status=failed
    wp action-scheduler run –batch-size=50

    1. Identify the plugin triggering the batch
      Temporarily disable one plugin at a time and monitor the logs:
      • Product Feed PRO
      • Google for WooCommerce
      • Facebook for WooCommerce

    These are common sources of batch processors running during shutdown.

    1. Check caching / object cache
      Please confirm:
      • Is any object cache enabled (Redis, Memcached, LiteSpeed cache, etc.)?
      • Does disabling WP Fastest Cache change the behavior?

    Caching layers can leave queries open longer than expected, which often triggers this error.

    1. Legacy REST API
      If you’re not actively using it, try disabling the WooCommerce Legacy REST API and re-test. While it’s not usually the root cause, it does add additional shutdown hooks.

    To help narrow this down further, could you confirm:

    1. Do these errors happen on every page load, or mainly during admin/cron activity?
    2. Is there any server-side object cache enabled by your host?
    3. Does disabling one of the feed plugins stop the errors? 

    Once we know which batch source is involved, we can provide more targeted guidance.

    Thread Starter emree

    (@emree)

    Hi, thank you too for your detailed answer.

    -I installed Legacy REST API plugin after seeing some other errors related rest api.
    -I noticed it’s not related to plugins because that error is creating if I deactivate it. But if I enabled them, errors are increasing, another similar errors are coming to debug.log
    -I guess it’s related to theme which I used. It’s woodmart. But I don’t know which feature is causing that.
    -When I asked to chatgpt, it said “If you close trigger, actions will work in near feature by the cron job.”
    I’m not too sure it’s correct or not. If it’s correct, delaying the db sync is not too important for me now.
    -If I clear the actions and it’s fixed, I’m afraid of that it’ll come again when these actions are created again.

    Plugin Support thelmachido a11n

    (@thelmachido)

    It’s been a while since we heard back from you for this reason we are closing this thread. 

    If WooCommerce has been useful for your store and you appreciate the support you’ve received, we’d truly appreciate it if you could leave us a quick review here: 

     https://ww.wp.xz.cn/support/plugin/woocommerce/reviews/#new-post

    Feel free to open a new forum topic if you run into any other problem. 

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

You must be logged in to reply to this topic.