https://gitlab.synchro.net/main/sbbs/-/commit/ead5ccf168ede09c1199b3e0
Modified Files:
src/sbbs3/services.cpp websrvr.cpp
Log Message:
Detect disconnection in JavaScript callback
First noticed (many times) in the Web Server, sbbsctrl-win32 would should very long-lived (seemingly infinitely lived) clients. When I lost Internet access last night for a few hours, this gave me the opportunity to debug these zombie clients and it turns out that a badly formed ssjs or xjs (in this case, webv4 user and system stats), that doesn't check for disconnection, and just loops, can loop almost forever (eventually the infinite loop detection, if enabled
in the configuration, should abort the script). Checking the connection state in the JS callback was the missing piece.
Through code review, I saw the same check was missing in the services server.
I reproduced this theoretical issue by modifying an existing service script to not check the connection itself and indeed it ran-on after disconnection without this fix.
I did the 10-checks before termination thing (giving the script a chance to self-terminate more gracefully) like is done in the Terminal Server.
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net