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

Worker fails to infinite loop continue throwing error #22840

Closed
terbooter opened this issue Jan 18, 2018 · 3 comments
Closed

Worker fails to infinite loop continue throwing error #22840

terbooter opened this issue Jan 18, 2018 · 3 comments

Comments

@terbooter
Copy link

Worker fails to infinite loop continue throwing error:

Next Illuminate\Database\QueryException: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 (SQL: update `jobs` set `reserved_at` = 1516226993, `attempts` = 256 where `id` = 1118) in /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:770
Stack trace:
#0 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(726): Illuminate\Database\Connection->runQueryCallback('update `jobs` s...', Array, Object(Closure))
#1 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(508): Illuminate\Database\Connection->run('update `jobs` s...', Array, Object(Closure))
#2 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(447): Illuminate\Database\Connection->affectingStatement('update `jobs` s...', Array)
#3 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2168): Illuminate\Database\Connection->update('update `jobs` s...', Array)
#4 /var/www/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php(253): Illuminate\Database\Query\Builder->update(Array)
#5 /var/www/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php(178): Illuminate\Queue\DatabaseQueue->markJobAsReserved(Object(stdClass))
#6 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(175): Illuminate\Queue\DatabaseQueue->pop('default')
#7 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(145): Illuminate\Queue\Worker->getNextJob(Object(Illuminate\Queue\DatabaseQueue), 'default')
#8 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(75): Illuminate\Queue\Worker->runNextJob('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#9 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#10 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(84): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#11 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#12 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(508): call_user_func_array(Array, Array)
#13 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(169): Illuminate\Container\Container->call(Array)
#14 /var/www/vendor/symfony/console/Command/Command.php(261): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/vendor/symfony/console/Application.php(817): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/vendor/symfony/console/Application.php(185): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/vendor/symfony/console/Application.php(116): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 {main}  

Environment:

"name": "laravel/framework",
"version": "v5.3.31",

php -v
PHP 7.0.25 (cli) (built: Nov  4 2017 10:58:36) ( NTS )

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $

Application and worker running using docker. Here is docker-compose.yml file

nginx:
  build: ./docker/nginx
  container_name: "nginx"
  volumes_from:
    - fpm:rw
  links:
    - fpm
  log_driver: "json-file"
  log_opt:
    max-size: "50m"
    max-file: "100"

fpm:
  build: ./docker/fpm
  container_name: "fpm"
  volumes:
    - ./laravel-app:/var/www:rw
  links:
    - redis
  log_driver: "json-file"
  log_opt:
    max-size: "50m"
    max-file: "100"

php-worker:
  build: ./docker/fpm
  container_name: "worker"
  volumes_from:
    - fpm
  restart: always
  log_driver: "json-file"
  log_opt:
    max-size: "50m"
    max-file: "100"
  command: php artisan queue:work

redis:
  image: redis:3.2
  restart: always
  container_name: "redis"
  log_driver: "json-file"
  log_opt:
    max-size: "5m"
    max-file: "10"
  command: redis-server
@crynobone
Copy link
Member

crynobone commented Jan 18, 2018 via email

@terbooter
Copy link
Author

Yes, I set tries limit

command: php artisan queue:work --tries=3

But I still think that it would be great to have default tries limit

@themsaid
Copy link
Member

You should always use a limit on your workers or you might end up consuming your server resources for no reason.

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