2018-08-15, 09:33 PM
(2018-08-08, 03:36 PM)tkurki Wrote: How about a watchdog thread that closes connections that the client has closed (that are in CLOSE_WAIT), no matter what?
Not that simple. Each connection in kplex has its own thread and each thread is responsible for all the data associated with that connection. If you simply close the socket the next client connection will re-use the closed file descriptor which its (old) controlling thread doesn't realise has been closed under it and gets you into a world of pain. Better to signal the controlling thread to die but then this is becomes a non-trivial architectural change.
Again, this is not ideal and hands up, no output with thousands of unfulfilled clients was not a scenario I considered, but a kludge as a workaround while awaiting a complete re-architecture is probably the most straight forward solution here.