出现了死锁问题?
production.ERROR: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction (SQL: update `product_skus` set `stock` = `stock` - 1, `updated_at` = 2019-02-03 09:33:41 where `id` = 112 and `stock` >= 1) {"userId":30,"email":"ducimus.velit@example.org","exception":"[object] (Illuminate\\Database\\QueryException(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction (SQL: update `product_skus` set `stock` = `stock` - 1, `updated_at` = 2019-02-03 09:33:41 where `id` = 112 and `stock` >= 1) at /var/www/laravel-shop/releases/7/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/laravel-shop/releases/7/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:119, PDOException(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/laravel-shop/releases/7/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117)
[stacktrace]
#0 /var/www/laravel-shop/releases/7/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('update `product...', Array, Object(Closure))
#1 /var/www/laravel-shop/releases/7/vendor/laravel/framework/src/Illuminate/Database/Connection.php(490): Illuminate\\Database\\Connection->run('update `product...', Array, Object(Closure))
#2 /var/www/laravel-shop/releases/7/vendor/laravel/framework/src/Illuminate/Database/Connection.php(423): Illuminate\\Database\\Connection->affectingStatement('update `product...', Array)
#3 /var/www/laravel-shop/releases/7/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2659): Illuminate\\Database\\Connection->update('update `product...', Array)
#4 /var/www/laravel-shop/releases/7/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2718): Illuminate\\Database\\Query\\Builder->update(Array)
#5 /var/www/laravel-shop/releases/7/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(844): Illuminate\\Database\\Query\\Builder->decrement('stock', 1, Array)
#6 /var/www/laravel-shop/releases/7/app/Models/ProductSku.php(28): Illuminate\\Database\\Eloquent\\Builder->decrement('stock', 1)
#7 /var/www/laravel-shop/releases/7/app/Services/OrderService.php(174): App\\Models\\ProductSku->decreaseStock(1)
推荐文章: