• Resolved acsafrica

    (@acsafrica)


    [25-Oct-2025 19:15:45 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->{closure:Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController::__construct():85}, 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
    [25-Oct-2025 19:15:45 UTC] WordPress database error Commands out of sync; you can't run this command now for query INSERT INTO
    wp_woocommerce_sessions (session_key, session_value, session_expiry) VALUES ('t_37de43a8b6e36f7c1a5b6dfc426bee', 'a:7:{s:22:\"shipping_for_package_0\";s:2004:\"a:2:{s:12:\"package_hash\";s:40:\"wc_ship_604f07e74a993ff1ca0ebe6b7244b6ff\";s:5:\"rates\";a:3:{s:12:\"flat_rate:20\";O:16:\"WC_Shipping_Rate\":2:{s:7:\"\0*\0data\";a:9:{s:2:\"id\";s:12:\"flat_rate:20\";s:9:\"method_id\";s:9:\"flat_rate\";s:11:\"instance_id\";i:20;s:5:\"label\";s:16:\"Abanista Express\";s:4:\"cost\";s:4:\"5000\";s:5:\"taxes\";a:1:{i:1;d:0;}s:10:\"tax_status\";s:7:\"taxable\";s:11:\"description\";s:0:\"\";s:13:\"delivery_time\";s:0:\"\";}s:12:\"\0*\0meta_data\";a:1:{s:5:\"Items\";s:90:\"Samsung Built-In Electric Oven, Pyrolytic Cleaning, Stainless Steel, NV68A1170BS × 1\";}}s:17:\"pickup_location:0\";O:16:\"WC_Shipping_Rate\":2:{s:7:\"\0*\0data\";a:9:{s:2:\"id\";s:17:\"pickup_location:0\";s:9:\"method_id\";s:15:\"pickup_location\";s:11:\"instance_id\";i:0;s:5:\"label\";s:30:\"Pickup Location (Kampala City)\";s:4:\"cost\";s:5:\"15000\";s:5:\"taxes\";a:1:{i:1;d:0;}s:10:\"tax_status\";s:7:\"taxable\";s:11:\"description\";s:0:\"\";s:13:\"delivery_time\";s:0:\"\";}s:12:\"\0*\0meta_data\";a:4:{s:15:\"pickup_location\";s:12:\"Kampala City\";s:14:\"pickup_address\";s:72:\"Johnson Street / William Street, Prime Complex, RM C16, Kampala, Kampala\";s:14:\"pickup_details\";s:62:\"Package will be ready for pickup with in 1-3 hours (Mon - Sat)\";s:5:\"Items\";s:90:\"Samsung Built-In Electric Oven, Pyrolytic Cleaning, Stainless Steel, NV68A1170BS × 1\";}}s:17:\"pickup_location:1\";O:16:\"WC_Shipping_Rate\":2:{s:7:\"\0*\0data\";a:9:{s:2:\"id\";s:17:\"pickup_location:1\";s:9:\"method_id\";s:15:\"pickup_location\";s:11:\"instance_id\";i:0;s:5:\"label\";s:29:\"Pickup Location (Head Office)\";s:4:\"cost\";s:5:\"15000\";s:5:\"taxes\";a:1:{i:1;d:0;}s:10:\"tax_status\";s:7:\"taxable\";s:11:\"description\";s:0:\"\";s:13:\"delivery_time\";s:0:\"\";}s:12:\"\0*\0meta_data\";a:4:{s:15:\"pickup_location\";s:11:\"Head Office\";s:14:\"pickup_address\";s:73:\"Namugongo - Bbuto Rd, opp. URA Customs Bonded Warehouse, Kampala, Kampala\";s:14:\"pickup_details\";s:62:\"Package will be ready for pickup with in 1-3 hours (Mon - Fri)\";s:5:\"Items\";s:90:\"Samsung Built-In Electric Oven, Pyrolytic Cleaning, Stainless Steel, NV68A1170BS × 1\";}}}}\";s:25:\"previous_shipping_methods\";s:98:\"a:1:{i:0;a:3:{i:0;s:12:\"flat_rate:20\";i:1;s:17:\"pickup_location:0\";i:2;s:17:\"pickup_location:1\";}}\";s:23:\"chosen_shipping_methods\";s:30:\"a:1:{i:0;s:12:\"flat_rate:20\";}\";s:22:\"shipping_method_counts\";s:14:\"a:1:{i:0;i:3;}\";s:11:\"cart_totals\";s:424:\"a:15:{s:8:\"subtotal\";s:7:\"1950000\";s:12:\"subtotal_tax\";d:0;s:14:\"shipping_total\";s:4:\"5000\";s:12:\"shipping_tax\";d:0;s:14:\"shipping_taxes\";a:1:{i:1;d:0;}s:14:\"discount_total\";d:0;s:12:\"discount_tax\";d:0;s:19:\"cart_contents_total\";s:7:\"1950000\";s:17:\"cart_contents_tax\";d:0;s:19:\"cart_contents_taxes\";a:1:{i:1;d:0;}s:9:\"fee_total\";s:1:\"0\";s:7:\"fee_tax\";d:0;s:9:\"fee_taxes\";a:0:{}s:5:\"total\";s:7:\"1955000\";s:9:\"total_tax\";d:0;}\";s:4:\"cart\";s:439:\"a:1:{s:32:\"bc438e29c3a8918daa0dc2ed43fef728\";a:11:{s:3:\"key\";s:32:\"bc438e29c3a8918daa0dc2ed43fef728\";s:10:\"product_id\";i:58949;s:12:\"variation_id\";i:0;s:9:\"variation\";a:0:{}s:8:\"quantity\";i:1;s:9:\"data_hash\";s:32:\"b5c1d5ca8bae6d4896cf1807cdf763f0\";s:13:\"line_tax_data\";a:2:{s:8:\"subtotal\";a:1:{i:1;d:0;}s:5:\"total\";a:1:{i:1;d:0;}}s:13:\"line_subtotal\";d:1950000;s:17:\"line_subtotal_tax\";d:0;s:10:\"line_total\";d:1950000;s:8:\"line_tax\";d:0;}}\";s:13:\"user_district\";s:7:\"Kampala\";}', 1761592543)
    ON DUPLICATE KEY UPDATE session_value = VALUES(session_value), session_expiry = VALUES(session_expiry) made by shutdown_action_hook, do_action('shutdown'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Session_Handler->save_data

    I am receiving this error leading to inaccessible site. I don’t know if it’s coming from WooCommerce plugin

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

    (@lovingbro)

    Hi @acsafrica,

    I understand how worrying it is to see your site become inaccessible with resource spikes, and those database errors are definitely alarming. The log you shared is very helpful. It shows two things happening at the same second. Action Scheduler is querying for a hook, and your WooCommerce session handler is trying to save a very large serialized session payload. The database error “Commands out of sync, you cannot run this command now” usually means a process left a MySQL result unconsumed, then another query ran on the same connection. In WordPress sites this is often triggered by a plugin or custom code that performs an unbuffered query, or by heavy operations coupled with persistent object caching.

    Here is how to stabilise and isolate the cause quickly
    1. Start with safe cleanups
    – Open WooCommerce, Status, Tools, then run
    – Clear customer sessions
    – Clear transients
    – Regenerate the product lookup tables
    After that, check Scheduled Actions under WooCommerce, Status, Scheduled actions, look for in progress and pending actions for wc_schedule_pending_batch_processes and run or cancel the stuck ones.

    2. Temporarily rule out caching and conflicts
    – If you use Redis or Memcached, or any persistent object cache, temporarily disable it and flush it, then retest.
    – Temporarily disable all plugins except WooCommerce, then retest. Re enable a few at a time to see when the error returns. Pay special attention to anything that interacts with checkout sessions, shipping rates, or batch jobs, for example pickup location and rate calculator plugins.
    – Switch to Storefront or Twenty Twenty Five briefly to exclude a theme level conflict.

    3. Check Action Scheduler health
    If you have WP CLI, run
    – wp action-scheduler run
    – wp action-scheduler cleanup
    Then reload the site and watch the error log timestamps.
    If the wc_schedule_pending_batch_processes hook keeps appearing, something is constantly re scheduling batches. Identify that extension and keep it disabled while testing.

    4. Reduce session bloat while testing
    The session payload in your log is very large because of multiple shipping rate objects and metadata. In WooCommerce, Status, Tools, use Clear customer sessions again after disabling non essential shipping and pickup extensions. This keeps session rows small and helps avoid timeouts during saves.

    5. Verify database and server basics
    – Confirm you are on a supported MySQL or MariaDB version and PHP. Requirements are here: https://wordpress.org/about/requirements/
    – Ask your host to confirm that mysqli on your server uses mysqlnd with default buffered queries, and that there is no multi query mode enabled for PHP MySQLi. Mis configuration here can trigger the out of sync error under load.

    6. Share diagnostics so we can pinpoint the culprit
    – Please share your System Status Report via one of these https://pastebin.com or https://gist.github.com
    – Also share the most recent lines from your error log around the time of a spike, plus a screenshot of WooCommerce, Status, Scheduled actions showing any in progress or failed tasks. You can use https://snipboard.io

    If the errors stop when Redis or a specific plugin is disabled, or after clearing sessions and stuck actions, that identifies the source. From there we can recommend a targeted fix. Let’s see how it goes after those first cleanups and the quick conflict test.

    Rezwan Shiblu

    (@rezwanshiblu1952)

    Hi @acsafrica,

    Thanks for sharing the error logs, which will be helpful to identify the root cause of resource usage spikes issue. According to error log, the issue is database sync problem between WooCommerce action scheduler and WooCommerce session handler.

    Action Scheduler (BatchProcessingController): handling wc_schedule_pending_batch_processes

    WC_Session_Handler: saving cart or checkout session data

    This means that two MySQL queries were trying to run at the same time in database and WooCommerce tries to save session data. In that time action schedular is still processing a scheduled task.

    Please follow the steps below that should help resolve the issue and reduce resource spikes:

    1. Please check if WooCommerce is updated and all extensions to the latest versions.
    2. Try to clear or manually run any stuck scheduled actions by navigating to WooCommerce > Status > Scheduled Actions.
    3. If you’re using any caching or object caching (Redis or Memcached), try flushing it to clear old session data.

    This issue does not mean WooCommerce itself is broken, but a background process and a session save event conflict. If resource usage is still high, check the Action Scheduler queue size as some sites run thousands of stuck or repeating actions.

    Also, you may check all scheduled tasks using this WP Control plugin – https://wordpress.org/plugins/wp-crontrol/

    Thomas

    (@thehinesgaphideaway)

    This error is prevalent with newest version of Woo; the site was being bogged down so much it triggers error resource limit reached. Sorry, no logging was saved on it since the site was un-usuable, we had to rollback to 10.2.2. From what I recall using Query Monitor, woo is doing loads (900+ or so) of duplicate database calls on wp_options; with options in the near thousand, this was taking over 15 minutes to generate on each shop page! Also, missed to mention, the transient cache was filling up to nearly 400MB, triggering transient cache delete improved response but not consistent. Newest woo seems to be broken.

    • This reply was modified 5 months ago by Thomas.
    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi @thehinesgaphideaway

    I understand that you have a somewhat similar problem.

    However, per forum best practices shown here, it is advised that you create a new thread so that we can address your issue(s) separately.

    You can create a new thread here: https://wordpress.org/support/plugin/woocommerce/#new-topic-0 and make sure to include as much information as you can.

    Thanks for understanding!

    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://wordpress.org/support/plugin/woocommerce/reviews/#new-post

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

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

You must be logged in to reply to this topic.