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

其他服务与master断开连接后,会触发master不断的重连,这个重连好像不会停止,还是说有什么地方可以配置 #766

Open
ChaseRay1989 opened this issue Aug 11, 2023 · 4 comments

Comments

@ChaseRay1989
Copy link
Contributor

2023-08-08T00:03:28.439] [ERROR] pinus-admin - [master-server-1 mqttClient.js] mqtt socket is close, remote server host: 10.65.189.10, port: 3005Error:
at Logger.pLogger. [as error] (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-logger/lib/logger.ts:76:34)
at Connection. (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-admin/lib/protocol/mqtt/mqttClient.ts:108:20)
at Connection.emit (node:events:390:28)
at Socket.emit (node:events:390:28)
at TCP. (node:net:687:12)
[2023-08-08T00:04:28.440] [INFO] pinus-admin - [master-server-1 mqttClient.js] reconnect delay 60 s
[2023-08-08T00:04:28.442] [ERROR] pinus-admin - [master-server-1 mqttClient.js] mqtt socket is error, remote server host: 10.65.189.10, port: 3005Error:
at Logger.pLogger. [as error] (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-logger/lib/logger.ts:76:34)
at Connection. (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-admin/lib/protocol/mqtt/mqttClient.ts:113:20)
at Connection.emit (node:events:390:28)
at Socket.emit (node:events:390:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
[2023-08-08T00:04:28.442] [ERROR] pinus-admin - [master-server-1 mqttClient.js] mqtt socket is close, remote server host: 10.65.189.10, port: 3005Error:
at Logger.pLogger. [as error] (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-logger/lib/logger.ts:76:34)
at Connection. (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-admin/lib/protocol/mqtt/mqttClient.ts:108:20)
at Connection.emit (node:events:390:28)
at Socket.emit (node:events:390:28)
at TCP. (node:net:687:12)
[2023-08-08T00:05:28.442] [INFO] pinus-admin - [master-server-1 mqttClient.js] reconnect delay 60 s
[2023-08-08T00:05:28.444] [ERROR] pinus-admin - [master-server-1 mqttClient.js] mqtt socket is error, remote server host: 10.65.189.10, port: 3005Error:
at Logger.pLogger. [as error] (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-logger/lib/logger.ts:76:34)
at Connection. (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-admin/lib/protocol/mqtt/mqttClient.ts:113:20)
at Connection.emit (node:events:390:28)
at Socket.emit (node:events:390:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
[2023-08-08T00:05:28.445] [ERROR] pinus-admin - [master-server-1 mqttClient.js] mqtt socket is close, remote server host: 10.65.189.10, port: 3005Error:
at Logger.pLogger. [as error] (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-logger/lib/logger.ts:76:34)
at Connection. (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-admin/lib/protocol/mqtt/mqttClient.ts:108:20)
at Connection.emit (node:events:390:28)
at Socket.emit (node:events:390:28)
at TCP. (node:net:687:12)
[2023-08-08T00:06:28.445] [INFO] pinus-admin - [master-server-1 mqttClient.js] reconnect delay 60 s
[2023-08-08T00:06:28.447] [ERROR] pinus-admin - [master-server-1 mqttClient.js] mqtt socket is error, remote server host: 10.65.189.10, port: 3005Error:
at Logger.pLogger. [as error] (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-logger/lib/logger.ts:76:34)
at Connection. (/home/gpx/app/avg-game-engine-2d/node_modules/pinus-admin/lib/protocol/mqtt/mqttClient.ts:113:20)
at Connection.emit (node:events:390:28)
at Socket.emit (node:events:390:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
[2023-08-08T00:06:28.447] [ERROR] pinus-admin - [master-server-1 mqttClient.js] mqtt socket is close, remote server host: 10.65.189.10, port: 3005Error:

通过上面的报错信息,查看了一下代码,代码触发了socket的close和error,然后调了self.onSocketClose();在onSocketClose()方法里面,把this.closed设成了true,然后调了一次reconnect,reconnect里面起了一个定时器去调connect方法,connect方法又把this.closed设成了false,connect不上又触发了socket的close和error,然后一直循环
image

@ChaseRay1989
Copy link
Contributor Author

我现在是每个服务都单独部署,例如例子里面的connetor,chat,master,这三个服务都是单独的部署,然后chat和connector是可以动态的扩容伸缩,可以新增实例,也可以回收部分实例,所以会出现与master断开连接的这种操作

@whtiehack
Copy link
Member

[master-server-1 mqttClient.js] mqtt socket is close, remote server host: 10.65.189.10, port: 3005

master 自己连自己? 有这种操作? 这个ip对吗?

@ChaseRay1989
Copy link
Contributor Author

其实也是可以master连master的,就是部署了两个master,一个做slave,然后主master同步信息给slave,如果主master挂了,slave顶上,其他服务连这个slave

@ChaseRay1989
Copy link
Contributor Author

但是我看源码,好像如果是某个服务断开了,会触发master不断的重连?不知道有没看错,this.closed这个值好像会一直被改成true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants