我在Ubuntu 16.04.1 LTS(VM)上有一个带有websockets的Mosquitto Broker
我在我的生产环境中使用它几周。我平均每秒发布150条消息,数十个客户作为订阅者没有问题。
我遇到了“无客户端无法连接”的问题,分别是标准端口和websocket端口,1883和8080。我甚至无法与这些端口建立telnet连接。当我重新启动经纪人时,问题就会消失。
这种情况会在几天内发生几次。
我将stdErr重定向到日志文件以调查发生了什么。
第一行:
1481665066: mosquitto version 1.4.10 (build date Thu, 25 Aug 2016 10:12:09 +0100) starting
1481665066: Config loaded from mosquitto.conf.
1481665066: Opening websockets listen socket on port 8080.
1481665066: Opening ipv4 listen socket on port 1883.
1481665066: Opening ipv6 listen socket on port 1883.
1481665066: New connection from 31.169.71.66 on port 1883.
1481665066: New client connected from 31.169.71.66 as dev32 (c1, k60, u'dev32').
1481665066: New connection from 31.169.71.66 on port 1883.
1481665066: New client connected from 78.186.134.50 as web_1f0a626d-072d-4803-b675-81c7042b14ec_20161214013743096 (c0, k30, u'dev').
1481665066: New client connected from 31.169.71.66 as dev39 (c1, k60, u'dev39').
1481665066: New connection from 31.169.71.66 on port 1883.
1481665066: New client connected from 92.44.21.41 as web_c3ebd064-6382-402a-a691-e20adddb2d01_20161214013902450 (c0, k30, u'dev').
1481665066: New client connected from 78.189.76.246 as web_8faeed52-465b-46cc-b330-e9760ea0d214_20161214003740750 (c0, k30, u'dev').
1481665066: New client connected from 31.169.71.66 as dev34 (c1, k60, u'dev34').
1481665066: New client connected from 95.8.136.192 as web_null_20161214003743476 (c0, k30, u'dev').
最后一行(就在我重新启动蚊子之前)
1481774805: Client web_aa990b69-8e5b-458a-8d64-0167e5e844b6_20161215014005790 has exceeded timeout, disconnecting.
1481774807: Socket error on client web_aa990b69-8e5b-458a-8d64-0167e5e844b6_20161215014005790, disconnecting.
1481774943: New connection from 63.143.42.242 on port 1883.
1481774943: Socket error on client <unknown>, disconnecting.
1481775243: New connection from 63.143.42.242 on port 1883.
1481775243: Socket error on client <unknown>, disconnecting.
1481775543: New connection from 63.143.42.242 on port 1883.
1481775543: Socket error on client <unknown>, disconnecting.
1481775733: New connection from 31.169.71.66 on port 1883.
1481775733: Client dev26 already connected, closing old connection.
1481775733: Client dev26 disconnected.
1481775733: New client connected from 31.169.71.66 as dev26 (c1, k60, u'dev26').
1481775843: New connection from 63.143.42.242 on port 1883.
1481775843: Socket error on client <unknown>, disconnecting.
1481775903: Client web_2e62e4b3-19e6-4386-8525-f2ba7b77d90a_20161214212838816 has exceeded timeout, disconnecting.
1481775905: Socket error on client web_2e62e4b3-19e6-4386-8525-f2ba7b77d90a_20161214212838816, disconnecting.
1481776143: New connection from 63.143.42.242 on port 1883.
1481776143: Socket error on client <unknown>, disconnecting.
1481776622: New connection from 63.143.42.242 on port 1883.
1481776622: Socket error on client <unknown>, disconnecting.
1481776623: New connection from 31.169.71.66 on port 1883.
1481776623: Client dev37 already connected, closing old connection.
1481776623: Client dev37 disconnected.
1481776623: New client connected from 31.169.71.66 as dev37 (c1, k60, u'dev37').
1481776921: New connection from 63.143.42.242 on port 1883.
1481776921: Socket error on client <unknown>, disconnecting.
1481777221: New connection from 63.143.42.242 on port 1883.
1481777221: Socket error on client <unknown>, disconnecting.
1481777457: New connection from 31.169.71.66 on port 1883.
1481777457: Client dev28 already connected, closing old connection.
1481777457: Client dev28 disconnected.
1481777457: New client connected from 31.169.71.66 as dev28 (c1, k60, u'dev28').
1481777521: New connection from 63.143.42.242 on port 1883.
1481777521: Socket error on client <unknown>, disconnecting.
1481777821: New connection from 63.143.42.242 on port 1883.
1481777821: Socket error on client <unknown>, disconnecting.
1481778045: New connection from 63.143.42.242 on port 1883.
1481778045: Socket error on client <unknown>, disconnecting.
1481778344: New connection from 63.143.42.242 on port 1883.
1481778344: Socket error on client <unknown>, disconnecting.
1481778650: New connection from 63.143.42.242 on port 1883.
1481778650: Socket error on client <unknown>, disconnecting.
1481778950: New connection from 63.143.42.242 on port 1883.
1481778950: Socket error on client <unknown>, disconnecting.
1481779250: New connection from 63.143.42.242 on port 1883.
1481779250: Socket error on client <unknown>, disconnecting.
1481779550: New connection from 63.143.42.242 on port 1883.
1481779550: Socket error on client <unknown>, disconnecting.
1481779850: New connection from 63.143.42.242 on port 1883.
1481779850: Socket error on client <unknown>, disconnecting.
注意:63.143.42.242是uptimerobot服务IP,因此它只是连接和断开连接以检查端口是否正在侦听。
我在JS和Java客户端都使用PAHO。
完整日志文件位于:https://codeshare.io/2B7rb5(3.6MB)
可能是什么原因?有没有解决方案?