今天启动GateWay服务后征程,想GateWay发送消息后,报这个错误了
------------------------ WORKERMAN -----------------------------
Workerman version:3.3.1 PHP version:5.5.31
------------------------ WORKERS -------------------------------
user worker listen processes status
Debw Gateway websocket://0.0.0.0:13016 1
Debw PushWorker text://127.0.0.1:13002 1
Debw Register text://0.0.0.0:1236 1
Debw TaskWorker text://127.0.0.1:13000 10
Debw TimeWorker text://127.0.0.1:13001 1
Debw TradeBusiness none 1
----------------------------------------------------------------
Press Ctrl-C to quit. Start success.
SendBufferToWorker fail. The connections between Gateway and BusinessWorker are not ready
SendBufferToWorker fail. The connections between Gateway and BusinessWorker are not ready
SendBufferToWorker fail. The connections between Gateway and BusinessWorker are not ready
SendBufferToWorker fail. The connections between Gateway and BusinessWorker are not ready
然后,因为我是MAC系统,我使用sudo dtruss -p 625来看GateWay的进程,再发送一次消息后,然后显示如下error提示,不知道是哪里出了问题呢?
sudo dtruss -p 625
SYSCALL(args) = return
dtrace: error on enabled probe ID 2067 (ID 328: syscall::select:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2341 (ID 602: syscall::poll:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2541 (ID 202: syscall::accept:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2479 (ID 326: syscall::fcntl:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2479 (ID 326: syscall::fcntl:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2022 (ID 822: syscall::lstat64:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2022 (ID 822: syscall::lstat64:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2022 (ID 822: syscall::lstat64:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2022 (ID 822: syscall::lstat64:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2022 (ID 822: syscall::lstat64:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2022 (ID 822: syscall::lstat64:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2039 (ID 152: syscall::open:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2232 (ID 820: syscall::fstat64:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2372 (ID 540: syscall::lseek:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2372 (ID 540: syscall::lseek:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2440 (ID 404: syscall::flock:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2041 (ID 150: syscall::write:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2053 (ID 154: syscall::close:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2053 (ID 154: syscall::close:return): invalid user access in action #5 at DIF offset 0
SendBufferToWorker fail. The connections between Gateway and BusinessWorker are not ready.
原因
BusinessWorker和Gateway之间的socket链接没有建立,Gateway向BusinessWorker发送消息失败。
出现这个问题的原因一般是start_gateway.php和start_businessworker.php中的
regtisterAddress
设置错误或者设置的不一致。
Gateway和BusinessWorker启动后会根据
regtisterAddress
设置的地址(Register服务地址)注册自己,
当start_gateway.php和start_businessworker.php中的
regtisterAddress
设置错误或者不一致时,
会导致Gateway和BusinessWorker无法通讯。
start_gateway.php和start_businessworker.php中的
regtisterAddress
地址格式为
Register的IP:端口号
,
其中端口号为start_register.php中的监听端口(假设是1238),
单机部署时,Register服务为本机ip 127.0.0.1,则start_gateway.php和start_businessworker.php中的
regtisterAddress
统一为
'127.0.0.1:1238'
。
分布式(集群)部署时,IP为实际Register服务部署的IP(分布式部署时只需要部署一台Register服务即可,假设是192.168.1.100),
则start_gateway.php和start_businessworker.php中的
regtisterAddress
统一为
'192.168.1.100:1238'
。
其它原因
业务设置了business_worker->onWorkerStart 或者 Events::onWorkerStart 回调,并且回调里有死循环或者长时间阻塞的代码,致使框架无法执行businessWorker与gateway建立连接逻辑,导致报错。
将死循环或者长时间阻塞的代码去掉即可恢复。
@walkor business启动了的
名字是 tradeBusiness. None 1
一直报错还是启动后报错?
@walker 启动没有问题,只要没有客户端链接,就不会有问题,调试了一下,感觉链接握手时就会报这个错误,如果不再连了,就没有这个错误。 现在不知该去哪个地方调试?
我自己搞错了,注册的地址可能是一不小心改动了
应该是配置错误,检查下start_gateway.php start_businessworker.php ,尤其是registerAddress选项
哦,没刷新页面,刚看到你说ok了