gpt4 book ai didi

php - 为什么 Beanstalkd 队列中的作业失败 - Laravel 4.2

转载 作者:搜寻专家 更新时间:2023-10-31 22:00:30 24 4
gpt4 key购买 nike

我的 beantalked 队列中“随机”有一些作业失败。两个问题:

1/通过查看数据库中失败的作业表,我如何解释其中记录的内容? Data 闭包在原始读取时意味着“无”。有什么办法可以获取更多信息吗?

2/我浏览了 Laravel 的控制台日志,这是失败的地方:

[2015-04-29 15:40:51] production.ERROR: exception 'ErrorException' with message 'Trying to get property of non-object' in /home/forge/api.hello.me/vendor/jeremeamia/SuperClosure/src/Jeremeamia/SuperClosure/SerializableClosure.php(99) : eval()'d code:6
Stack trace:...

但是我不知道到底是什么失败了...堆栈跟踪没有帮助,只是从

开始
    [internal function]: Jeremeamia\SuperClosure\SerializableClosure::{closure}(Object(Illuminate\Queue\Jobs\BeanstalkdJob))
#2 /home/forge/api.hello.me/vendor/jeremeamia/SuperClosure/src/Jeremeamia/SuperClosure/SerializableClosure.php(64): ReflectionFunction->invokeArgs(Array)

并在几行之后完成

#15 /home/forge/api.hello.me/vendor/symfony/console/Symfony/Component/Console/Application.php(124): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /home/forge/api.hello.me/artisan(59): Symfony\Component\Console\Application->run()
#17 {main} [] []

关于我如何理解/找出正在发生的事情有什么想法吗?队列甚至不会一直失败...

ps:完整的堆栈跟踪:

#0 /home/forge/api.hello.me/vendor/jeremeamia/SuperClosure/src/Jeremeamia/SuperClosure/SerializableClosure.php(99) : eval()'d code(6): Illuminate\Exception\Handler->handleError(8, 'Trying to get p...', '/home/forge/api...', 6, Array)
#1 [internal function]: Jeremeamia\SuperClosure\SerializableClosure::{closure}(Object(Illuminate\Queue\Jobs\BeanstalkdJob))
#2 /home/forge/api.hello.me/vendor/jeremeamia/SuperClosure/src/Jeremeamia/SuperClosure/SerializableClosure.php(64): ReflectionFunction->invokeArgs(Array)
#3 /home/forge/api.hello.me/vendor/laravel/framework/src/Illuminate/Queue/IlluminateQueueClosure.php(36): Jeremeamia\SuperClosure\SerializableClosure->__invoke(Object(Illuminate\Queue\Jobs\BeanstalkdJob))
#4 /home/forge/api.hello.me/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(96): IlluminateQueueClosure->fire(Object(Illuminate\Queue\Jobs\BeanstalkdJob), Array)
#5 /home/forge/api.hello.me/vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php(50): Illuminate\Queue\Jobs\Job->resolveAndFire(Array)
#6 /home/forge/api.hello.me/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(205): Illuminate\Queue\Jobs\BeanstalkdJob->fire()
#7 /home/forge/api.hello.me/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(157): Illuminate\Queue\Worker->process('beanstalkd', Object(Illuminate\Queue\Jobs\BeanstalkdJob), '3', '0')
#8 /home/forge/api.hello.me/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(105): Illuminate\Queue\Worker->pop('beanstalkd', 'default', '0', '10', '3')
#9 /home/forge/api.hello.me/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(67): Illuminate\Queue\Console\WorkCommand->runWorker('beanstalkd', 'default', '0', '128', false)
#10 /home/forge/api.hello.me/vendor/laravel/framework/src/Illuminate/Console/Command.php(112): Illuminate\Queue\Console\WorkCommand->fire()
#11 /home/forge/api.hello.me/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(253): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /home/forge/api.hello.me/vendor/laravel/framework/src/Illuminate/Console/Command.php(100): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /home/forge/api.hello.me/vendor/symfony/console/Symfony/Component/Console/Application.php(889): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /home/forge/api.hello.me/vendor/symfony/console/Symfony/Component/Console/Application.php(193): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /home/forge/api.hello.me/vendor/symfony/console/Symfony/Component/Console/Application.php(124): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /home/forge/api.hello.me/artisan(59): Symfony\Component\Console\Application->run()
#17 {main} [] []

最佳答案

Laravel 队列的工作方式是将您提供的所有数据序列化为 payload,并将其保存在您的数据库中。当您处理队列时,它会神奇地反序列化所有这些数据,以便您在内存中拥有基本上与将其弹出​​到队列中时相同的对象。当您更改序列化对象的类定义,或者您的对象没有完全正确序列化(这里似乎就是这种情况)时,问题就会出现...

我建议你尽量不要序列化匿名函数,因为 Laravel 使用 SuperClosure 来做到这一点,而且它非常 hacky。

[内部函数]:Jeremeamia\SuperClosure\SerializableClosure::{closure}(Object(Illuminate\Queue\Jobs\BeanstalkdJob))

尝试将更简单的对象插入您的 Beanstalk 队列(即不将对象发送到队列),您将不会遇到此问题。

关于php - 为什么 Beanstalkd 队列中的作业失败 - Laravel 4.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29961580/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com