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
Activity
SUCCESS: Integrated in
inspectIT - Integration #385
INSPECTIT-2574: fixed a typo in the TcpConnection (ivan.senic: 0df2bbe80b8a225d08c3ed63017b1ca50dc4cf0f)
(edit) inspectit.shared.all/src/main/java/rocks/inspectit/shared/all/kryonet/TcpConnection.java
SUCCESS: Integrated in
inspectIT - Integration #384
INSPECTIT-2574: correct idle queue handling in case of closing (ivan.senic: 09ba5226687d54bb094ebd45ce938243b54c54d8)
(edit) inspectit.shared.all/src/main/java/rocks/inspectit/shared/all/kryonet/TcpConnection.java
(edit) inspectit.shared.all/src/main/java/rocks/inspectit/shared/all/kryonet/Connection.java