[Interest] QWebSocketServer - server randomly stops accepting connections

Jakub Narolewski izowiuz at gmail.com
Wed Apr 3 17:59:15 CEST 2019

I have this one, strange problem with QWebSocketServer that is driving me insane.
My project is a very simple, websocket-based online game server. It uses Qt SQL modules and makes use of some light QEvent'ing.
Up until recently I used uWebSockets to drive my wss communications. To make matters simpler to me I decided to reimplement 'network' part of the application using Qt native module - QWebSocketServer.
It generally works nice - it survives my naive fuzzing tech and cleanly integrates with Qt's event loop.

But here is the thing.

It randomly, without any error, stops accepting incoming connections. This is VERY hard for me to debug. It happens anywhere between 8 to about 60ish hours after I start my debian unit with systemctl and is fixed immediately when I restart it's service.
I'm connected to every possible error related signal from QWebSocketServer interface, ssl or otherwise - nothing is emited when this happens.
When I ssh to my server I see nominal CPU and memory usage - no leaks, infinite loops or other fun things.
I recently used QObject's timerEvent to spam some qInfos into sys logs. I log:

void i9ms::Server::dumpServerStatus() const
	qInfo() << "[Server status]"
			<< "isListening:" << m_wsServer->isListening()
			<< "hasPendingConnections:" << m_wsServer->hasPendingConnections()
			<< "errorString:" << m_wsServer->errorString();

Right now, at the time of writing this message, the server is 'frozen' for about 5 hours and all I see in logs are lines:

Apr 03 16:56:12 vps504293 mrserver_release[22148]: [info    ]         [Server status] isListening: true hasPendingConnections: false errorString: ""

Problem goes away when I return to uWebSockets-based wss implementation. I let the test server run on it for weeks without problems.
I have tested this on Ubuntu 18.04.2 LTS and Debian 9 both provided 'as-is' from my VPS provider - OVH.

I appreciate any feedback or help, have no idea where to go from here. I could possibly try master or 5.12.X branches but this will force me to add 'another configure step' for deployment and is not trival.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190403/c6fbb0e0/attachment.html>

More information about the Interest mailing list