Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue worker daemon loses connection when unserializing model #16312

Closed
abhisheksrivastav opened this issue Nov 8, 2016 · 5 comments
Closed

Comments

@abhisheksrivastav
Copy link

abhisheksrivastav commented Nov 8, 2016

  • Laravel Framework version 5.0.35
  • PHP Version: PHP 5.6.27-1+deb.sury.org~trusty+1 (cli)
  • Database Driver & Version: Ver 14.14 Distrib 5.7.13, for Linux (x86_64)
  • OS Ubuntu 14.04

Description:

It occurs in case of longer running Queue Jobs.

Log message part


#38 {main}

Next exception 'Illuminate\Database\QueryException' with message 'Error while sending STMT_PREPARE packet. PID=3291 (SQL: select * from manage_campaigns where manage_campaigns.id = 9 limit 1)' in /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Connection.php:624
Stack trace:
#0 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Connection.php(580): Illuminate\Database\Connection->runQueryCallback('select * from ...', Array, Object(Closure)) #1 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Connection.php(297): Illuminate\Database\Connection->run('select * from ...', Array, Object(Closure))
#2 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1377): Illuminate\Database\Connection->select('select * from `...', Array, true)
#3 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1367): Illuminate\Database\Query\Builder->runSelect()
#4 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1354): Illuminate\Database\Query\Builder->getFresh(Array)
#5 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(380): Illuminate\Database\Query\Builder->get(Array)
#6 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(162): Illuminate\Database\Eloquent\Builder->getModels(Array)
#7 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(136): Illuminate\Database\Eloquent\Builder->get(Array)
#8 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(84): Illuminate\Database\Eloquent\Builder->first(Array)
#9 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(114): Illuminate\Database\Eloquent\Builder->find(9, Array)
#10 [internal function]: Illuminate\Database\Eloquent\Builder->findOrFail(9)
#11 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(3362): call_user_func_array(Array, Array)
#12 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php(65): Illuminate\Database\Eloquent\Model->__call('findOrFail', Array)
#13 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php(65): App\Models\ManageCampaign->findOrFail(9)
#14 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php(40): App\Commands\InitiateCampaignRequest->getRestoredPropertyValue(Object(Illuminate\Contracts\Database\ModelIdentifier))
#15 [internal function]: App\Commands\InitiateCampaignRequest->__wakeup()
#16 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(36): unserialize('O:36:"App\Comma...')
#17 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(126): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#18 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php(48): Illuminate\Queue\Jobs\Job->resolveAndFire(Array)
#19 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(207): Illuminate\Queue\Jobs\DatabaseJob->fire()
#20 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(159): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), '1', 0)
#21 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(113): Illuminate\Queue\Worker->pop('database', 'initiateCampaig...', 0, 3, '1')
#22 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(85): Illuminate\Queue\Worker->runNextJobForDaemon('database', 'initiateCampaig...', 0, 3, '1')
#23 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(104): Illuminate\Queue\Worker->daemon('database', 'initiateCampaig...', 0, 128, 3, '1')
#24 /var/www/html/application/deploy/releases/20161103111929/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(70): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'initiateCampaig...', 0, 128, true)

Similar issue addressed here #10604 on this thread,

I hope applying same patch could resolve the issue here also for laravel 5.0 verison
Please move the above patch for 5.0 versions of laravel too.

Thanks,
Abhishek

@themsaid
Copy link
Member

themsaid commented Nov 8, 2016

What is the database driver?

@abhisheksrivastav
Copy link
Author

Below are details from database.php

'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST'),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'options' => [PDO::MYSQL_ATTR_LOCAL_INFILE => true]
],

@sisve
Copy link
Contributor

sisve commented Nov 9, 2016

The presence of DatabaseJob in the stacktrace indicates that the database queue driver is used.

@abhisheksrivastav
Copy link
Author

yes I am using database as a queue driver

@themsaid
Copy link
Member

themsaid commented Nov 9, 2016

5.0 is technically not supported anymore, I highly recommend that you upgrade to 5.1 or 5.3, a lot of fixes has been introduced.

@themsaid themsaid closed this as completed Nov 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants