Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swoole\\Table::set(): unable to allocate memory #372

Closed
tgl123 opened this issue Sep 4, 2018 · 12 comments · Fixed by swoft-cloud/swoft-component#276
Closed

Swoole\\Table::set(): unable to allocate memory #372

tgl123 opened this issue Sep 4, 2018 · 12 comments · Fixed by swoft-cloud/swoft-component#276

Comments

@tgl123
Copy link

tgl123 commented Sep 4, 2018

Q A
Bug report? yes/no
Feature request? yes/no
Swoft version x.y.z
Swoole version x.y.z (by php --ri swoole)
PHP version x.y.z (by php -v)
Runtime environment Docker etc.

Details

1.项目中有做定时任务:利用websockert clients 10秒发送一次数据给websocket server

2.运行几天后,websocket连接正常连接,但就是收不到信息,日志中报很多如下错误:

{"log":"Warning: Swoole\Table::set(): unable to allocate memory. in /var/www/swoft/vendor/swoft/task/src/Crontab/Crontab.php on line 245\n","stream":"stdout","time":"2018-09-03T23:12:00.848825852Z"}

3.定时任务代码:

/**
 * crontab定时任务
 * 每10秒执行一次
 *
 * @Scheduled(cron="*\/10 * * * * *")
 */
public function cronOrderTask() {
    $data = array('type' => 'to_all', 'info' => ''); //标志type为to_all表示群发
    $socket = new \Swoole\Client\WebSocket(env("HOST_NAME"), env("HTTP_PORT"), '/order');
    $keyFile = env('SSL_KEY_FILE');
    $certFile = env('SSL_CERT_FILE');
    if (env('OPEN_HTTP2_PROTOCOL')) {
        //如果是开启ssl,就时行加密传输
        $socket->enableCrypto($keyFile, $certFile);
    }
    $s = $socket->connect(5);
    if ($s) {
        $info=$this->get_info();//循环获取订单信息
        $data['info'] = $info;
        if (!empty($info)) {
            //有数据时才发送给websocket
            $socket->send(json_encode($data));
        }
    } else {
        App::info(__CLASS__ . '中的方法' . __FUNCTION__ . ": websocket 连接异常!");
    }
    App::info('===from task===');
    return 'cron';
}

Describe what you are trying to achieve and what goes wrong.

// paste output here

Provide minimal script to reproduce the issue

// paste code
@inhere inhere added the bug label Sep 4, 2018
@huangzhhui
Copy link
Contributor

huangzhhui commented Sep 5, 2018

#371

#491

#113

@limingxinleo
Copy link
Contributor

swoole 版本是多少

@tgl123
Copy link
Author

tgl123 commented Sep 27, 2018

swoole版本 4.04

@tgl123
Copy link
Author

tgl123 commented Nov 22, 2018

这个bug有计划何时解决呢,现在感觉都没发用在生产环境,不太稳定哦。我现在的业务都有集成进swoft了。进退2难呀

@huangzhhui
Copy link
Contributor

你可以先不使用计划任务,通过其它方案解决实现

@lion1120lion
Copy link

请问这个bug修复了?我的定时任务也出现“不能分配内存”问题

@jianwubayiba
Copy link

一堆
xxx@docker01 Warning: Swoole\Table::set(): unable to allocate memory. in /var/www/swoft/vendor/swoft/task/src/Crontab/Crontab.php on line 245
xxx@docker01
xxx@docker01 Warning: Swoole\Table::set(): unable to allocate memory. in /var/www/swoft/vendor/swoft/task/src/Crontab/Crontab.php on line 245

@zhana0
Copy link

zhana0 commented Feb 12, 2019

我也遇到了,现在结局了吗?

@kyleliwotian
Copy link

我也遇见了,2677031999 qq

@inhere
Copy link
Member

inhere commented Feb 21, 2019

task 发了新版本 各位观察下还有问题吗?

@tgl123
Copy link
Author

tgl123 commented Feb 22, 2019

请问要怎么升级呢

@stelin
Copy link
Member

stelin commented Jul 9, 2019

@tgl123 2.0已发布,建议升级到2.0

@stelin stelin closed this as completed Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants