使用队列偶尔会报错,请问怎么排查问题?

业务场景:呼叫中心通话结束后,laravel通过redis队列下载录音文件
使用工具:supervisor
偶尔会在supervisor里面看到报错:
我现在php内存增加到128M还是偶尔会报错,难不成还是内存不够?

[2021-03-16 14:01:35][KAN56eRFnaozEo3YCBoAAMLUdRQOPZx8] Processing: App\Jobs\DownloadRecording

   Symfony\Component\ErrorHandler\Error\FatalError 

  Allowed memory size of 134217728 bytes exhausted (tried to allocate 1404928 bytes)

  at vendor/guzzlehttp/psr7/src/Stream.php:95
     91if (!isset($this->stream)) {
     92throw new \RuntimeException('Stream is detached');
     93}
     94▕ 
  ➜  95▕         $contents = stream_get_contents($this->stream);
     9697if ($contents === false) {
     98throw new \RuntimeException('Unable to read stream contents');
     99}


   Whoops\Exception\ErrorException 

  Allowed memory size of 134217728 bytes exhausted (tried to allocate 1404928 bytes)

  at vendor/guzzlehttp/psr7/src/Stream.php:95
     91if (!isset($this->stream)) {
     92throw new \RuntimeException('Stream is detached');
     93}
     94▕ 
  ➜  95▕         $contents = stream_get_contents($this->stream);
     9697if ($contents === false) {
     98throw new \RuntimeException('Unable to read stream contents');
     99}

      [2m+1 vendor frames [22m
  2   [internal]:0
      Whoops\Run::handleShutdown()

使用队列后台下载文件偶尔报错请问怎么排查问题

laravel里面日志:

[2021-03-16 14:01:37] production.ERROR: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1404928 bytes) {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 134217728 bytes exhausted (tried to allocate 1404928 bytes) at /www/wwwroot/saas/vendor/guzzlehttp/psr7/src/Stream.php:95)
[stacktrace]
#0 {main}
"} 
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 7

就是还不够

3年前 评论
91it (楼主) 3年前
  1. supervisor 本质上还是守护了 horizon的进程,执行错误可以去 horizon 里查看失败任务,有详细记载的错误回调。
  2. supervisor 启动后会将当前代码缓存起来。更新了相关代码后要执行一下 supervisor restart all 重载代码
3年前 评论
91it (楼主) 3年前

guzzle 可以直接把下载内容保存到文件,文档:docs.guzzlephp.org/en/stable/reque...

Supervisor 管理器,这个是啥东东?

3年前 评论

file

应该是直接读取了大文件,找找分块下载。

3年前 评论
91it (楼主) 3年前

加了内存之后 队列重启了吗 如果重启了 可能就是没找到配置文件

3年前 评论
陈先生

我怎么感觉是你下载的文件太大了....

3年前 评论
Epona

处理的数据太大了。

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!