【问题标题】:Laravel Supervisord DB DeadlockLaravel Supervisord 数据库死锁
【发布时间】:2016-02-19 19:58:52
【问题描述】:

使用 Laravel 和 Supervisord 保持 php artisan queue:listen 运行。由于某种原因,它已经运行了很长时间,现在突然我收到这个错误,然后工作正在重新启动

[2016-02-19 14:49:23] production.ERROR: exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction (SQL: updateaccountssetupdated_at= 2016-02-19 14:49:23,ReceivableBalance= 11968.1419330000,RecoupableIncomeTotal= 0,RecoupableExpenseTotal= 0 whereid= 74)' in /home/ec2-user/MPWLaravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:555

...

我读到几篇文章说我正在解除锁定,因为太多队列工作人员正在运行,但我应该只有一个。

当我跑步时,ps aux | grep artisan 我得到...

c2-user 12838 0.2 0.6 348288 26200 ? S 19:42 0:01 php artisan queue:listen --timeout=600 ec2-user 12920 76.3 2.0 484132 78212 ? R 19:49 3:47 php artisan queue:work --queue=https://sqs.us-east-1.amazonaws.com/129423672202/MpwNewProduction --delay=0 --memory=128 --sleep=3 --tries=0 --env=production

这表明两个队列工作人员正在运行?哪个可能导致死锁?还是那只是一个正在运行,然后queue:listen 仍在检查新消息?

迷路了。

【问题讨论】:

  • 自从队列由主管启动以来,是否对代码库进行了有关数据库交互的任何更改?如果是,重启 supervisord 后是否还会出现这种情况?
  • 我不这么认为。我在最新的 master 分支上。

标签: mysql laravel supervisord


【解决方案1】:

最终成为我不知道的第二个正在运行的队列侦听器。对于任何可能偶然发现类似问题的人。

【讨论】:

  • 好吧,我也面临同样的问题,但是,不同的队列侦听器侦听“默认”以外的不同队列。
猜你喜欢
  • 2012-09-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-19
  • 1970-01-01
相关资源
最近更新 更多