TcpConnection not correctly maintaining the idle queue in case of close

Description

If the connection is closed and one of the output streams is not in the idle queue, but it the writing queue, then this stream will be closed and not be available anymore for this connection. This can lead to the fact that the connection does not have any more streams to write to. Since a connection can be reused after the close, this is a problem, especially on the client side (agent).

When this happens on the agent, we would constantly try to reconnect to the server and fail. This loop of connect/disconnect will eventually drain the byte buffer pool on the CMR as the buffers will not be returned to the pool until the garbage collection occurs.

The fix should:

  • maintain the idle queue so that on connection reusing there is a buffer to add

  • close the streams if the connection will not be reused

Environment

None

Status

Assignee

Ivan Senic

Reporter

Ivan Senic

Labels

None

Pull Request

None

Integrator

None

Sprint

Fix versions

Priority

Highest
Configure