Redis Plugin - open new connection upon caught exception
Description
When pipelining commands it is possible for the context reader to contain un-used replies when an exception is thrown before the last pipelined response is consumed. These unconsumed replies would then be read by the next user of the cached connection.
This could also be true of the context write buffer, though the current implementation is free from this issue. However, there is no mechanism (other than to close the connection) to prevent stray replies pending on the socket server side.
Both the output buffer and the context reader could be cleared when using a cached connection, however, the same can not be said for the server.
The solution is to close the connection upon encountering an exception and opening one on the next instance.
When pipelining commands it is possible for the context reader to contain un-used replies when an exception is thrown before the last pipelined response is consumed. These unconsumed replies would then be read by the next user of the cached connection.
This could also be true of the context write buffer, though the current implementation is free from this issue. However, there is no mechanism (other than to close the connection) to prevent stray replies pending on the socket server side.
Both the output buffer and the context reader could be cleared when using a cached connection, however, the same can not be said for the server.
The solution is to close the connection upon encountering an exception and opening one on the next instance.