Coder Social home page Coder Social logo

swoole-crontab's Introduction

Swoole-Crontab(基于Swoole扩展)

1.概述

  • 基于swoole的定时器程序,支持秒级处理.
  • 异步多进程处理。
  • 完全兼容crontab语法,且支持秒的配置,可使用数组规定好精确操作时间
  • 单中心-多客户端模式,能够横向扩展
  • web界面管理,增删改查任务,完整的权限控制.
  • 请使用swoole扩展1.8.0+
  • v0.8版本入口

2.架构图

3.Crontab配置

介绍一下时间配置

0   1   2   3   4   5
|   |   |   |   |   |
|   |   |   |   |   +------ day of week (0 - 6) (Sunday=0)
|   |   |   |   +------ month (1 - 12)
|   |   |   +-------- day of month (1 - 31)
|   |   +---------- hour (0 - 23)
|   +------------ min (0 - 59)
+-------------- sec (0-59)[可省略,如果没有0位,则最小时间粒度是分钟]

4.开始使用

1.修改配置

1.1 中心服配置

/path/to/src/center/configs/dev/db.php 修改数据库配置
进入mysql数据库执行/path/to/doc/crontab.sql 的sql文件
src/center/_init.php   修改 PUBLIC_PATH   swoole framework框架所在的路径

1.2 admin管理后台的配置文件修改

src/admin/configs/dev/db.php  修改数据库配置
src/admin/configs/dev/service.php  中心服启动时候监听的ip端口,需要跟中心服通讯
src/public/index.php  
    修改 WEBROOT       域名
    修改 PUBLIC_PATH   swoole framework框架所在的路径

2.下载swoole framework框架到本地/data/www/public/ framework

3.配置nginx,列子如下:

server {
    listen       80;
    server_name  crontab.test.com;
    
    root /data/www/wwwroot/swoole-crontab/src/public;
    
    index index.php index.html;
    location / {
        if (!-e $request_filename) {
            rewrite ^/(.*)$ /index.php;
        }
    }
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

}

4.启动中心服

/path/to/php /path/to/src/center/center.php  start -d -h 127.0.0.1 -p 8901

5.启动客户端

-h 是指中心服地址 -p 中心服端口
/path/to/php /path/to/src/agent/agent.php start -d -h 127.0.0.1 -p 8901

6.web界面访问

输入nginx配置的地址访问web界面,默认用户名/密码是admin/admin

7.操作步骤

请按照以上步骤操作,因为admin后台是通过接口连接上中心服来进行管理.所以必须先启动中心服,再打开admin管理后台

4.使用交流

1.后台截图

2.更加清晰的架构图.感谢@xufei100

QQ群:560807006

5.TODO

  • 去除nginx依赖
  • 配置文件统一
  • 去除swoole framework框架的依赖
  • restful api接口
  • 通过命令行管理任务
  • 无中心服依赖

swoole-crontab's People

Contributors

osgochina avatar ouminghai avatar sky-l avatar w3yyb avatar zealotrunner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swoole-crontab's Issues

僵尸进程问题

PHP 5.6.3 (cli) (built: Dec 24 2014 15:18:35)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

你好,我在测试中发现了大量的僵尸进程
public function run($task)
{
$output_file = (isset($task["output"]) && !empty($task["output"])) ? $task["output"] : '/dev/null';
$cmd = $task["cmd"] . ' >> ' . $output_file;
exec($cmd, $output, $status);
Main::log_write($cmd . ",已执行.status:" . $status);
exit($status);
}
这里面使用的是exec执行代码,应该会导致僵尸进程,怎么没有使用swoole的进程 start wait 呢,只有主进程等待子进程执行完成才不会导致僵尸。

HTTP服务启动失败

09:12:00 : HTTP Server 已启动
/path/to/swoole-src-swoole-1.7.16-stable/src/reactor/ReactorBase.c:138: swReactor_add: Assertion `fd <= SwooleG.max_sockets' failed.

时间设置:

   array(
        'taskname' => 'imRobotAddGroup', 
        'rule' => '* */5 * * * *',
        "unique" => 1, 
        'execute'  => 'Cmd',
        'args' =>
            array(
                'cmd'    => 'curl xxxxx',
                'ext' => '',
            ),
    ),
'imRobotSendMsg' =>
    array(
        'taskname' => 'imRobotAddGroup',
        'rule' => '* */5 * * * *',
        "unique" => 1, 
        'execute'  => 'Cmd',
        'args' =>
            array(
                'cmd'    => 'curl xxxx',
                'ext' => '',
            ),
    ),

'changeLiveStatus' =>
    array(
        'taskname' => 'imRobotAddGroup',
        'rule' => '* * * * *',
        "unique" => 1,
        'execute'  => 'Cmd',
        'args' =>
            array(
                'cmd'    => 'curl xxxx',
                'ext' => '',
            ),
    )

上边两个我是想每隔5秒钟执行一次,第三个是每隔1分钟执行一次,但是开始执行后,前两个是每秒钟执行一次,当第三个开始执行的时候,前两个就不执行了,过了5分钟又开始执行,请问怎么写才能满足我的想法

unable to select

unable to select. Error: Interrupted system call [4] in
agent/Lib/SOAClient.php on line 468

Fatal error: Uncaught Swoole\Error: must be forked outside the coroutine

执行php main.php -s start
提示:Fatal error: Uncaught Swoole\Error: must be forked outside the coroutine in Donkey-0.8/src/include/Process.class.php:21
Stack trace:
Donkey-0.8/src/include/Process.class.php(21): Swoole\Process->start()
Donkey-0.8/src/include/Crontab.class.php(216): Process->create_process('taskid1', Array)
Donkey-0.8/src/include/Crontab.class.php(185): Crontab::do_something(2)
#3 {main}
Donkey-0.8/src/include/Process.class.php on line 21

swoole 版本
swoole

Swoole => enabled
Author => Swoole Team [email protected]
Version => 4.4.16
Built => Feb 27 2020 14:45:23
coroutine => enabled
kqueue => enabled
rwlock => enabled
openssl => OpenSSL 1.0.2j 26 Sep 2016
pcre => enabled
zlib => 1.2.8
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 262144 => 262144

操作系统 macOS Sierra 10.12.6

后来我在Donkey-0.8/src/include/Crontab.class.php 注册定时任务register_timer() 添加 Swoole\Timer::set([
'enable_coroutine' => false,
]);
禁用协程,再次启动才能正常运行demo,请问是要禁用协程吗

一个小BUG

src/admin/classes/LoginController类下的validate方法需要从protected改为public

无法正常使用

你好,为什么我配置完了,只能显示权限和用户页面,其他页面都无法正常显示。 报错如下:
__construct

need a param of total


#0 line:54 call:Swoole\Error::info file:/opt/tony/data/www/public/framework/libs/Swoole/Pager.php
#1 line:34 call:Swoole\Pager->__construct file:/opt/tony/data/www/wwwroot/swoole-crontab-master/src/admin/controllers/Agent.php
#2 line:761 call:App\Controller\Agent->index file:/opt/tony/data/www/public/framework/libs/Swoole/Swoole.php
#3 line:50 call:Swoole->runMVC file:/opt/tony/data/www/wwwroot/swoole-crontab-master/src/public/index.php

谁能帮忙看一下嘛 ? 谢谢

个人建议

这几天准备使用swoole-crontab 替换 linux crontab

在使用过程中主要以下几个问题

  1. 不清晰怎么启动,补上架构图就ok了,作者补上了,也附上我的 https://processon.com/view/link/59698feae4b064b2bffca3cd
  2. 都启动了就是不执行任务,后面找原因是未安装pcre-devel 不能 foreach swoole_table
  3. 启动后报不能 load resource [cache/session] ,后面去读代码,独立服务启动,不能使用php默认session,需要添加配置文件 cache.php ,里面配置 redis缓存或者文件缓存

为了更好的使用,我建议作者可以考虑以下几点

  1. 去掉nginx+fpm 模式,直接使用 swoole 来做 httpserver 提供admin端web服务
  2. 添加docker运行环境,来避免环境搭建问题,使用环境变量来确定运行环境的选择
  3. 添加好的日志模块,方便调试和错误追踪
  4. 添加swoole-framework为子模块或者使用composer

非常感谢作者的付出,我这提供docker模块,可供你参考

https://github.com/LingdianIT-Com/swoole-crontab/tree/lingdian/docker

http.php,段错误

self::$http = new swoole_http_server(self::$host, self::$port, SWOOLE_BASE);//段错误
下面 2行,也不行,报错
//$method = $request->server["REQUEST_METHOD"];//
//$path = $request->server["PATH_INFO"];

php /data/wwwroot/time.9ume.com/src/center/center.php start -d 启动时候

PHP Warning: require_once(/framework/libs/lib_config.php): failed to open stream: No such file or directory in /data/wwwroot/time.9ume.com/src/center/_init.php on line 37
PHP Fatal error: require_once(): Failed opening required '/framework/libs/lib_config.php' (include_path='.:/usr/local/php71/lib/php:/data/www/public/') in /data/wwwroot/time.9ume.com/src/center/_init.php on line 37

Undefined index

2017/07/18 10:06:33 [error] 3082#0: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: _gid in /opt/www/swoole-crontab/src/admin/classes/CommonController.php on line 37
PHP message: PHP Notice: Undefined index: _gname in /opt/www/swoole-crontab/src/admin/classes/CommonController.php on line 38" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /password/modifypassword/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8900", referrer: "http://localhost:8900/user/index/"

2017/07/18 10:06:36 [error] 3082#0: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: _gid in /opt/www/swoole-crontab/src/admin/classes/CommonController.php on line 37
PHP message: PHP Notice: Undefined index: _gname in /opt/www/swoole-crontab/src/admin/classes/CommonController.php on line 38
PHP message: PHP Notice: Undefined index: _gid in /opt/www/swoole-crontab/src/admin/controllers/Crontab.php on line 35
PHP message: PHP Warning: Invalid argument supplied for foreach() in /opt/www/swoole-crontab/src/admin/controllers/Crontab.php on line 50
PHP message: PHP Notice: Undefined index: _gid in /opt/www/swoole-crontab/src/admin/controllers/Crontab.php on line 41" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /crontab/index/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8900", referrer: "http://localhost:8900/password/modifypassword/"

5.3.3兼容性问题

你好,我在5.3.3上修改了PHP的语法兼容性上的问题之后,没有报错但是启动之后没有运行任务。

如何用开出孙子进程

我是希望添加进程组的概念,然后进行到进程组去生成孙子进程时出现问题。

请问你知道如何去生成孙子进程吗?

crontab.js浏览器执行报错

在Safari下使用,添加和编辑任务时,crontab.js 182行由于未关闭中括号,$("input[name='v_second']") 未能正确找到,出现 undefined,保存任务后,无法正常执行。

...
cron_parse:function (strVal,strid)
    {
        var ary = null;
        var end;
        var objRadio = $("input[name='" + strid + "'");  // --> 此处缺一个 ] 来关闭
        if (strVal == '*'){
            objRadio.eq(0).prop("checked", true);
...

cronAgent /agent/index/ 管理报错

Warning: Invalid argument supplied for foreach() in swoole-crontab/src/admin/controllers/Agent.php on line 44
$ret = App\Service::getInstance()->call("Agent::getAgents",$gets,$page,$pagesize)->getResult(10);这个查询并没有返回["total"=>$pager->total,"rows"=>$list]而是返回空 agents表里有数据的。这是为什么呢?

客户端无法接受到crontab任务

image

image

image

老师您好:这是我遇到到的问题,麻烦您帮忙解决一下。中心服务器连接好,使用客户端也显示了连接成功,但是定时任务无法发送成功,显示发送失败?

如何指定agent启动后绑定的网卡ip?

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.47.208.181 netmask 255.255.248.0 broadcast 10.47.215.255
ether 00:16:3e:10:06:16 txqueuelen 1000 (Ethernet)
RX packets 2993139873 bytes 3668054774619 (3.3 TiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1745359630 bytes 343925852893 (320.3 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 0 (Local Loopback)
RX packets 30935796 bytes 14148769302 (13.1 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 30935796 bytes 14148769302 (13.1 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:24:96:8b txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

这台机器启动agent后, agent绑到192.168.122.1上面去了

安装好后的默认的测试任务没能执行

任务日志显示“任务发送失败”;同时php_error.log中显示:
PHP Warning: Swoole\Database\MySQLi SQL Error:Commands out of sync; you can't run this command now


insert into term_logs (taskid,runid,explain,msg,createtime) values('3097968986801831941','3112807076871536715','任务开始','{"id":3097968986801831941,"execute":"\/bin\/echo 'hello swoole-crontab' >> \/home\/wwwlogs\/crontab.log","agents":"1","taskname":"\u6d4b\u8bd5\u4efb\u52a1","runuser":"nobody","runid":3112807076871536715}','2017-01-13 18:08:59')

Server: localhost:3306.

另:求该项目的架构图及实现流程
多谢

几处修正

1,说明文档 fix center为center.php
地点:/path/to/php /path/to/src/center/center start -d -h 127.0.0.1 -p 8901

2, sql文件 swoole-crontab/doc/crontab.sql
agents 表有四个字段,但是insert插入语句有五个字段值;
地点:INSERT INTO agents VALUES ('1', 'Crontab服务', '127.0.0.1', '8902', '0');

Task超时减1

//超时则把运行中的数量-1

带来的问题:
耗时进程(可能1个小时),设置了并发数为1。但是超时(5分钟)之后,并发数减1,会造成并发数失效。
假如设置了每半小时执行一次,那么就会重复执行。

这个场景关键点就在于说,业务不能确定具体的执行时间,因而可能会因为并发数减1,造成并发这个功能无效。

所以,这个减1的初衷是什么,如果去掉是否可以,以及会带来什么风险吗?
@osgochina

发现个小bug

center/App/Agent.php
120行 $gname =""; 这个写法在php7.1下会出错
应该改成 $gname =[];

这是什么情况啊。

[2016-03-16 16:42:37 $28956.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9].
[2016-03-16 16:42:37 $28956.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9].
php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertion fd <= SwooleG.max_sockets' failed. [2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6 [2016-03-16 16:42:37 $28958.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9]. [2016-03-16 16:42:37 $28958.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9]. php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertionfd <= SwooleG.max_sockets' failed.
[2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6
[2016-03-16 16:42:37 $28960.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9].
[2016-03-16 16:42:37 $28960.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9].
php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertion fd <= SwooleG.max_sockets' failed. [2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6 [2016-03-16 16:42:37 $28962.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9]. [2016-03-16 16:42:37 $28962.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9]. php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertionfd <= SwooleG.max_sockets' failed.
[2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6
[2016-03-16 16:42:37 $28964.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9].
[2016-03-16 16:42:37 $28964.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9].
php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertion fd <= SwooleG.max_sockets' failed. [2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6 [2016-03-16 16:42:37 $28966.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9]. [2016-03-16 16:42:37 $28966.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9]. php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertionfd <= SwooleG.max_sockets' failed.
[2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6
[2016-03-16 16:42:37 $28968.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9].
[2016-03-16 16:42:37 $28968.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9].
php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertion fd <= SwooleG.max_sockets' failed. [2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6 [2016-03-16 16:42:37 $28970.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9]. [2016-03-16 16:42:37 $28970.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9]. php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertionfd <= SwooleG.max_sockets' failed.
[2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6
[2016-03-16 16:42:37 $28972.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9].
[2016-03-16 16:42:37 $28972.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9].
php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertion fd <= SwooleG.max_sockets' failed. [2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6 [2016-03-16 16:42:37 $28974.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9]. [2016-03-16 16:42:37 $28974.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9]. php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertionfd <= SwooleG.max_sockets' failed.
[2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6
[2016-03-16 16:42:37 $28976.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9].
[2016-03-16 16:42:37 $28976.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9].
php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertion fd <= SwooleG.max_sockets' failed. [2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6 [2016-03-16 16:42:37 $28978.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9]. [2016-03-16 16:42:37 $28978.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9]. php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertionfd <= SwooleG.max_sockets' failed.
[2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6
[2016-03-16 16:42:37 $28980.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9].
[2016-03-16 16:42:37 $28980.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9].
php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertion fd <= SwooleG.max_sockets' failed. [2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6 [2016-03-16 16:42:37 $28982.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9]. [2016-03-16 16:42:37 $28982.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9]. php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertionfd <= SwooleG.max_sockets' failed.
[2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6
[2016-03-16 16:42:37 $28985.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9].
[2016-03-16 16:42:37 $28985.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9].
php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertion fd <= SwooleG.max_sockets' failed. [2016-03-16 16:42:37 $27990.0] WARNING swManager_check_exit_status: worker#1 abnormal exit, status=0, signal=6 [2016-03-16 16:42:37 $28987.0] ERROR swoole_fcntl_set_block(:668): fcntl(13733424, GETFL) failed. Error: Bad file descriptor[9]. [2016-03-16 16:42:37 $28987.0] ERROR swoole_fcntl_set_block(:688): fcntl(13733424, SETFL, opts) failed. Error: Bad file descriptor[9]. php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:158: swReactor_add: Assertionfd <= SwooleG.max_sockets' failed.
php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:135: swReactor_get: Assertion fd < SwooleG.max_sockets' failed. php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:135: swReactor_get: Assertionfd < SwooleG.max_sockets' failed.
php: /opt/swoole-src-swoole-1.8.2-stable/src/reactor/ReactorBase.c:135: swReactor_get: Assertion `fd < SwooleG.max_sockets' failed.

有错误

PHP Fatal error: Cannot use object of type swoole_http_response as array in swoole-crontabv0.2/src/include/Http.class.php on line 50
,另外为什么 http://127.0.0.1:9501 ,第一次能访问,以后就不能访问 了

agent取消注册问题

“在1.7.15以上版本中,当设置dispatch_mode = 1/3时会自动去掉onConnect/onClose事件回调” https://wiki.swoole.com/wiki/page/49.html

咱们的swoole是1.8+,另外默认配置dispatch_mode=3,

'dispatch_mode' => 3,

导致onClose不会被执行,当agent断开时候,server无法摘除agent

public function onClose($serv, $fd, $from_id)

@osgochina 幸苦看下是调整下默认的dispatch_mode或者有别的方案

遇到的问题

老师您好,向您请教一下 现在我的情况是主机上运行中心服务端,中心服务端能收到信息,客户端显示连接成功,使用php center.php start -d -h 本机地址 -p 8901 无法进入客户端,只有使用127.0.0.1能够进入,如果想用其他机器就无法就无法连接了,请问应该怎么解决这个问题呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.