dcaoyuan/spray-websocket

WebSocketServerConnection actor leak?

nefilim opened this issue · 2 comments

it looks like WebSocketServerConnection actors might not be destroyed when a connection is reset which I believe is the intention of:

  def closeLogic: Receive = {
    case ev: Http.ConnectionClosed =>
      context.stop(self)
      log.debug("Connection closed on event: {}", ev)
  }

but from what I can see, Http.ConnectionClosed is never sent to WebSocketServerConnection, I only see ErrorClosed being sent (twice, connection reset by peer & TcpConnection actor died). I am not gracefully closing the client connection, still, one should probably handle this situation.

I believe PeerClosed is sent in case of a graceful connection shutdown.

If a Tcp.ConnectionClosed event is fired in pipelines, it should will be sent to WebSocketServerConnection. BTW, Tcp.ConnectionClosed is exactly the Http.ConnectionClosed.

After 4 months production running, we confirm there should be no actor leak.