0

我有一个带有 PHP Thruway 工作人员的 Crossbar.io 服务器。最近,我开始收到以下错误。现在大约每天发生一次:

2016-04-17T21:08:12+0000 [Router       9572] Unable to format event {'log_logger': <Logger 'crossbar.router.protocol.WampWebSocketServerProtocol'>, 'log_time': 1460927292.17918, 'log_source': None, 'log_format': 'Traceback (most recent call last):\n  File "/usr/local/lib/python2.7/site-packages/autobahn/wamp/websocket.py", line 88, in onMessage\n    for msg in self._serializer.unserialize(payload, isBinary):\n  File "/usr/local/lib/python2.7/site-packages/autobahn/wamp/serializer.py", line 106, in unserialize\n    raise ProtocolError("invalid serialization of WAMP message ({0})".format(e))\nProtocolError: invalid serialization of WAMP message (Expected object or value)\n'}: tuple index out of range
2016-04-17T21:08:15+0000 [Guest        9583] The connected has closed with reason: close
2016-04-17T21:08:19+0000 [Guest        9583] PHP Fatal error:  Call to a member function call() on null in /var/www/html/pickupServer/vendor/voryx/thruway/src/Thruway/ClientSession.php on line 106
2016-04-17T21:08:19+0000 [Guest        9583] Fatal error: Call to a member function call() on null in /var/www/html/pickupServer/vendor/voryx/thruway/src/Thruway/ClientSession.php on line 106
2016-04-17T21:08:19+0000 [Controller   9565] Guest worker2 exited with error A process has ended with a probable error condition: process ended with exit code 255.

有谁知道防止这种情况发生?

如果在这种情况下失败,我如何自动重新启动工作人员?

4

1 回答 1

0

我在 linux 中通过 MONIT 检查 crossbar-controler 进程并添加以下行来解决它:

如果孩子 < 3 则重新启动

3 是 crossbar-controler 在我的环境中拥有的 os 子进程数。如果其中任何一个退出,则交叉开关会自行重新启动并通知我。您必须检查您正在运行的子进程的数量:

sudo 服务交叉开关状态。

这解决了错误退出工作,但需要重新启动交叉开关控制器。我相信这必须是解决问题的横梁/高速公路方式。理想的方法是尝试捕获所有可能的 php 错误以防止致命的工作人员退出。

谢谢

于 2016-06-02T22:49:26.933 回答