Php 作业失败,允许的内存大小为Laravel 6到地平线
在收到3000个寄存器后通过循环运行作业: 允许的内存大小134217728字节已用尽(已尝试分配 16384字节){“异常”:“[对象] (Symfony\Component\Debug\Exception\FatalErrorException(代码:1): 允许的内存大小134217728字节已用尽(已尝试分配 16384字节)在 /var/www/vendor/doctor/dbal/lib/doctor/dbal/Driver/PDOStatement.php:117) 我的作业有:Php 作业失败,允许的内存大小为Laravel 6到地平线,php,laravel,laravel-6,laravel-horizon,Php,Laravel,Laravel 6,Laravel Horizon,在收到3000个寄存器后通过循环运行作业: 允许的内存大小134217728字节已用尽(已尝试分配 16384字节){“异常”:“[对象] (Symfony\Component\Debug\Exception\FatalErrorException(代码:1): 允许的内存大小134217728字节已用尽(已尝试分配 16384字节)在 /var/www/vendor/doctor/dbal/lib/doctor/dbal/Driver/PDOStatement.php:117) 我的作业有:p
public$timeout=950;
我使用的是带有PHP7.2、Laravel6、Horizon、Redis和MySql的Laradock环境
我的设置horizon.php有:
'memory_limit' => 2048,
'environments' => [
'local' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['journey_processing','default','journey_calculations'],
'balance' => 'false',
'minProcesses' => 1,
'maxProcesses' => 1,
'tries' => 1,
'delay' => 0,
'sleep' => 3,
'timeout' => 420 // Timeout after 7 minutes
],
],
],
我的队列redis设置:
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'retry_after' => 2990,
'block_for' => null,
],
关于内存的我的php信息:
我的docker环境内存。
我找到了一个解决方案。我记得我安装了一个望远镜,之后,作业中的内存问题开始出现。所以我在检查作业日志时,看到了以下内容:
[2019-09-19 09:55:12][3449] Processing: App\Jobs\CreateJourney
Symfony\Component\Debug\Exception\FatalErrorException : Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes)
at /var/www/vendor/laravel/telescope/src/Storage/DatabaseEntriesRepository.php:145
141| $table = $this->table('telescope_entries');
142|
143| $entries->chunk($this->chunkSize)->each(function ($chunked) use ($table) {
144| $table->insert($chunked->map(function ($entry) {
> 145| $entry->content = json_encode($entry->content);
146|
147| return $entry->toArray();
148| })->toArray());
149| });
Whoops\Exception\ErrorException : Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes)
at /var/www/vendor/laravel/telescope/src/Storage/DatabaseEntriesRepository.php:145
141| $table = $this->table('telescope_entries');
142|
143| $entries->chunk($this->chunkSize)->each(function ($chunked) use ($table) {
144| $table->insert($chunked->map(function ($entry) {
> 145| $entry->content = json_encode($entry->content);
146|
147| return $entry->toArray();
148| })->toArray());
149| });
Exception trace:
1 Whoops\Run::handleError("Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes)", "/var/www/vendor/laravel/telescope/src/Storage/DatabaseEntriesRepository.php")
/var/www/vendor/filp/whoops/src/Whoops/Run.php:433
2 Whoops\Run::handleShutdown()
我卸载了Laravel望远镜,现在它仍像以前一样工作。我希望这对任何人都有帮助。如果我问这个问题,我会尽可能多地发布关于你问题中最重要的部分:工作本身。Laravel 6现在有问题,它不稳定,需要重新开发