Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Poco::Net::HTTPServer::stopAll() not working as expected #436

Closed
kblaschke opened this Issue · 0 comments

2 participants

Kai Blaschke Günter Obiltschnig
Kai Blaschke

When stopping a Poco::Net::HTTPServer using the stopAll() method, the server won't stop properly if under heavy load. All open connections will be closed, but the server is still accepting new connections during the notification period, before actually closing down the server listening socket. These connections will not be closed, and continue to serve requests if they're using Keep-Alive.

How to reproduce:

  • Implement a simple HTTP server which uses unlimited Keep-Alive connections
  • Use stopAll() to end the server, and use joinAll() on the server's thread pool to wait until all connection threads are finished
  • Run the service, and hammer it with jMeter etc. with enabled Keep-Alive to simulate load
  • Stop the service e.g. by using Ctrl+c
  • The service will close the socket, but continue to serve a number of connections

A simple fix is swapping the two lines in HTTPServer::stopAll(), so the server socket will be closed before ending already-open connections. See the pull request below.
Currently, a workaround has to be used - first call stop(), then stopAll().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.