Laravel Supervisord DB Deadlock
<p>Using Laravel and Supervisord to keep php artisan queue:listen running. For some reason it has run well for a long time and now suddenly I'm getting this error and then the job is restarting </p>

<p><code>[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: update</code>accounts<code>set</code>updated_at<code>= 2016-02-19 14:49:23,</code>ReceivableBalance<code>= 11968.1419330000,</code>RecoupableIncomeTotal<code>= 0,</code>RecoupableExpenseTotal<code>= 0 where</code>id<code>= 74)' in /home/ec2-user/MPWLaravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:555</code></p>

<p>...</p>

<p>I read a few things that said I was getting a dealock because too many queue workers were running but I should only have one.</p>

<p>When I run, <code>ps aux | grep artisan</code> I get...</p>

<p><code>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</code></p>

<p>which suggests two queue workers running? Which may cause the deadlock? Or is that just the one running and then the <code>queue:listen</code> is just still checking for new messages?</p>

<p>So lost.</p>