Title: Deadlock issue
Last modified: September 16, 2026

---

# Deadlock issue

 *  [Tomasz Dziuda](https://wordpress.org/support/users/dziudek/)
 * (@dziudek)
 * [3 weeks, 1 day ago](https://wordpress.org/support/topic/deadlock-issue/)
 * Hi after latest update to 4.9.0 I observe regular issues with deadlocks:
 *     ```wp-block-code
       WordPress database error Deadlock found when trying to get lock; try restarting transaction for query DELETE FROM XXX_postmeta WHERE post_id = 1 AND meta_key = 'wpdesk_migration_XXXXXXXXXXXXXXXXXXX' AND CAST(CASE WHEN LOCATE('|', meta_value) > 0 THEN SUBSTRING_INDEX(meta_value, '|', -1) ELSE SUBSTRING_INDEX(meta_value, '_', -1) END AS UNSIGNED) < UNIX_TIMESTAMP() made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WPDesk\ShopMagic\Plugin->WPDesk\ShopMagic\{closure}, do_action('shopmagic/core/initialized/v2'), WP_Hook->do_action, WP_Hook->apply_filters, WPDesk\ShopMagicCart\Plugin->WPDesk\ShopMagicCart\{closure}, ShopMagicVendor\WPDesk\Migrations\WpdbMigrator->migrate, ShopMagicVendor\WPDesk\Mutex\WordpressPostLease->acquireLock, ShopMagicVendor\WPDesk\Mutex\WordpressPostLease->deleteExpiredLocksPHP Fatal error:  Uncaught ShopMagicVendor\WPDesk\Mutex\MutexException: Unable to clean expired post leases. Deadlock found when trying to get lock; try restarting transaction in /XXX/public_html/wp-content/plugins/shopmagic-for-woocommerce/vendor_prefixed/wpdesk/wp-mutex/src/WPDesk/Mutex/WordpressPostLease.php:158
       ```
   
    -  This topic was modified 3 weeks, 1 day ago by [Tomasz Dziuda](https://wordpress.org/support/users/dziudek/).

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

 *  Thread Starter [Tomasz Dziuda](https://wordpress.org/support/users/dziudek/)
 * (@dziudek)
 * [3 weeks, 1 day ago](https://wordpress.org/support/topic/deadlock-issue/#post-19021287)
 * FYI – I have temporary solved this issue by replacing:
 *     ```wp-block-code
       public function migrate(): void    {        require_once \ABSPATH . 'wp-admin/includes/upgrade.php';        $mutex = $this->mutex;        if (!$mutex->acquireLock()) {
       ```
   
 * With:
 *     ```wp-block-code
       public function migrate(): void    {        require_once \ABSPATH . 'wp-admin/includes/upgrade.php';        // patch start        if (!$this->needs_migration()) {            $this->migration_error_notice->clear();            return;        }        // patch end        $mutex = $this->mutex;        if (!$mutex->acquireLock()) {
       ```
   
 *  Plugin Support [krzysztofskorupa](https://wordpress.org/support/users/krzysztofskorupa/)
 * (@krzysztofskorupa)
 * [3 weeks, 1 day ago](https://wordpress.org/support/topic/deadlock-issue/#post-19021469)
 * Hi,
 * thank you very much for reaching out.
 * Does this issue also occur in the previous version of ShopMagic?
 * If I understand correctly, the problem only appeared in the latest version, is
   that right?
 * Best regards,
 *  Thread Starter [Tomasz Dziuda](https://wordpress.org/support/users/dziudek/)
 * (@dziudek)
 * [3 weeks, 1 day ago](https://wordpress.org/support/topic/deadlock-issue/#post-19021480)
 * [@krzysztofskorupa](https://wordpress.org/support/users/krzysztofskorupa/) – 
   yes, this issue was introduced in v.4.9.0
 *  Plugin Support [krzysztofskorupa](https://wordpress.org/support/users/krzysztofskorupa/)
 * (@krzysztofskorupa)
 * [2 weeks, 6 days ago](https://wordpress.org/support/topic/deadlock-issue/#post-19023054)
 * Hi, thanks for the confirmation.
 * I’ve forwarded this thread to our team for review and likely a fix.
 * For now, I recommend reverting to the previous version (since the error wasn’t
   present there) or using the fix you noticed.
 * I’ll let you know when a new version is released or when I hear back from the
   developer.
 * Best regards,
 *  Plugin Support [krzysztofskorupa](https://wordpress.org/support/users/krzysztofskorupa/)
 * (@krzysztofskorupa)
 * [2 days, 10 hours ago](https://wordpress.org/support/topic/deadlock-issue/#post-19037794)
 * Hi, thank you for your patience.
   Here: [https://wordpress.org/plugins/shopmagic-for-woocommerce/advanced/znajdziesz](https://wordpress.org/plugins/shopmagic-for-woocommerce/advanced/znajdziesz)
   version 4.9.1 Beta
 * I would appreciate it if you could test it to see if it resolves the reported
   issue.
   I look forward to hearing from you.Best regards,

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

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdeadlock-issue%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/shopmagic-for-woocommerce/assets/icon-256x256.png?rev=2847401)
 * [ShopMagic - email automation for WordPress](https://wordpress.org/plugins/shopmagic-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shopmagic-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shopmagic-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/shopmagic-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shopmagic-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shopmagic-for-woocommerce/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [krzysztofskorupa](https://wordpress.org/support/users/krzysztofskorupa/)
 * Last activity: [2 days, 10 hours ago](https://wordpress.org/support/topic/deadlock-issue/#post-19037794)
 * Status: not resolved