【算解决了】webman的队列webman/redis-queue任务堆积,导致内存超过,导致进程退出

xiaoming

版本号

webman/redis-queue 1.3.2

问题描述

我操作大表 ,导致所有队列进程busy, mysql阻塞写入,我理解
但索引添加完成, busy消失,但是内存超了 ,我设置了512M还是超了

出现
2024-07-01 22:46:50 pid:30566 Worker[30566] process terminated with ERROR: E_ERROR "Allowed memory size of 536870912 bytes exhausted (tried to allocate 8454040 bytes) in /www/wwwroot/webman/vendor/workerman/workerman/Connection/TcpConnection.php on line 593"
2024-07-01 22:46:50 pid:30532 worker[plugin.webman.redis-queue.consumer:30566] exit with status 11
2024-07-01 22:46:54 pid:30564 Worker[30564] process terminated with ERROR: E_ERROR "Allowed memory size of 536870912 bytes exhausted (tried to allocate 8454040 bytes) in /www/wwwroot/webman/vendor/workerman/workerman/Connection/TcpConnection.php on line 593"
2024-07-01 22:46:54 pid:30532 worker[plugin.webman.redis-queue.consumer:30564] exit with status 11
2024-07-01 22:46:54 pid:30563 Worker[30563] process terminated with ERROR: E_ERROR "Allowed memory size of 536870912 bytes exhausted (tried to allocate 36864 bytes) in /www/wwwroot/webman/vendor/workerman/redis/src/Protocols/Redis.php on line 166"
2024-07-01 22:46:54 pid:30532 worker[plugin.webman.redis-queue.consumer:30563] exit with status 11

暂时解决

我现在把所有延时队列 全部改成及时消费,目前cpu和内存都正常了

如果单条数据量大,我建议非必要不要用延时队列

509 5 0
5个回答

xiaoming

不是很能理解,索引添加完成 应该是按顺序消费起来 ,怎么会内存爆了

  • 暂无评论
six

猜测是单条消息数据太大了。
比如从数据库读出了大量数据放到了一条消息里去消费

  • xiaoming 2024-07-01

    都512M 单条数据不可能那么大

xiaoming

https://www.workerman.net/q/10597
这个有人反馈设置了 delay 就这样
我也是有队列设置了 delay

  • 暂无评论
tanhongbin

linux 还是 windows 系统? 这种情况不应该的还是代码有问题 我们也用过 没出现任何问题 linux系统 静态php部署的呢

xiaoming
应该是还没到消费这部   看报错信息 是框架内部

<?php
public function consume($data)
{
    try {
        ZmqLog::create($data);
    } catch (\Throwable $ex) {

    }  
}
  • tanhongbin 2024-07-02

    没遇到 这种情况 我们消费的数据比你们要打多了 我们是一次发送上百万手机号码 也是用的队列 ,没遇到过内存泄漏问题 涨到一定程度就不增长了 内存使用

  • xiaoming 2024-07-02

    你们是延时队列吗 我觉得应该是 https://github.com/webman-php/redis-queue/issues/2 由于我单条数据大大于2m,
    导致 这部一下子取得128条 ,导致内存爆了

  • tanhongbin 2024-07-02

    我不是延迟队列,很有可能是延迟队列 同一时刻有128条拿出来嘛?

  • xiaoming 2024-07-02

    看源码我觉得是 我现在把所有延时队列 全部改成及时消费,目前cpu和内存都正常了,

  • tanhongbin 2024-07-02

    为啥你一个数据能2M 这么大 ???按道理 不应这么大的呀 群主一次取128就是怕内存爆掉,但是没想到你一个数据都2M 多

×
🔝