Skip to content

TCPServerDispatcher::run() issue #1884

@micheleselea

Description

@micheleselea

I found a possible problem that could end up with unusable tcp server.
In function TCPServerDispatcher::run() the line std::auto_ptr<TCPServerConnection> pConnection(_pConnectionFactory->createConnection(pCNf->socket())); create application TCP handler.
If for some reason the creation throw exeption (for example because do something with a broken socket or similar) the thread return in pool and so no problem because try catch is taken but we jump the line
--_currentThreads; so in the end, after some of this issue you will refuse all new connection because in function void TCPServerDispatcher::enqueue(const StreamSocket& socket) we check _currentThreads < _pParams->getMaxThreads()
So I think we should put --_currentThreads; in a "scoped decrement" class or try catch the createConnection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions