首页 > 解决方案 > 传递给 Pheanstalk\Job::__construct() 的参数 2 必须是字符串类型,给定 null

问题描述

我正在运行一个 Laravel 应用程序并使用 Beanstalkd 和"pda/pheanstalk": "^4.0"我的队列,它运行良好。然而,几个小时后,我的工作开始崩溃,它抛出了这个崩溃,当我这样做时,php artisan queue:restart它又开始工作了。这些日志中没有关于我的代码或应用程序的任何具体内容。有没有人遇到过这种情况?

Argument 2 passed to Pheanstalk\Job::__construct() must be of the type string, null given, called in /var/www/api/vendor/pda/pheanstalk/src/Pheanstalk.php on line 278 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 2 passed to Pheanstalk\\Job::__construct() must be of the type string, null given, called in /var/www/api/vendor/pda/pheanstalk/src/Pheanstalk.php on line 278 at /var/www/api/vendor/pda/pheanstalk/src/Job.php:30)
[stacktrace]
#0 /var/www/api/vendor/pda/pheanstalk/src/Pheanstalk.php(278): Pheanstalk\\Job->__construct(1, NULL)
#1 /var/www/api/vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php(129): Pheanstalk\\Pheanstalk->reserveWithTimeout(0)
#2 /var/www/api/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(253): Illuminate\\Queue\\BeanstalkdQueue->pop('express')
#3 /var/www/api/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(107): Illuminate\\Queue\\Worker->getNextJob(Object(Illuminate\\Queue\\BeanstalkdQueue), 'express')
#4 /var/www/api/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\\Queue\\Worker->daemon('beanstalkd', 'express,listing...', Object(Illuminate\\Queue\\WorkerOptions))
#5 /var/www/api/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\\Queue\\Console\\WorkCommand->runWorker('beanstalkd', 'express,listing...')
#6 [internal function]: Illuminate\\Queue\\Console\\WorkCommand->handle()
#7 /var/www/api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)
#8 /var/www/api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#9 /var/www/api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#10 /var/www/api/vendor/laravel/framework/src/Illuminate/Container/Container.php(576): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#11 /var/www/api/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\\Container\\Container->call(Array)
#12 /var/www/api/vendor/symfony/console/Command/Command.php(255): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#13 /var/www/api/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#14 /var/www/api/vendor/symfony/console/Application.php(915): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#15 /var/www/api/vendor/symfony/console/Application.php(272): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Queue\\Console\\WorkCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#16 /var/www/api/vendor/symfony/console/Application.php(148): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#17 /var/www/api/vendor/laravel/framework/src/Illuminate/Console/Application.php(90): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#18 /var/www/api/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(133): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#19 /var/www/api/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#20 {main}
"}

标签: phplaravelsymfonybeanstalkd

解决方案


推荐阅读