Closed twittner closed 8 years ago
The problem BlockedIndefinitelyOnMVar
should be resolved with #45
I'd propose to close this one and add another ticket about more consistent and better structured errors in hedis
Unfortunately the testcase from above gives me the same result with hedis 0.7.1.
Yep, it looks like a different problem - we've got commands waiting for the BoundedChan
but the closed connection abrupts runRedis
execution without draining that channel.
Thanks for quick answer @twittner
Please consider the following test case:
Execution yields (potentially after multiple runs):
The
ConnectionLost
exception was provoked by the fact that there isn't actually a Redis server listening on port 9042 but a different service (Cassandra). The test case is setup this way to highlight two aspects:errConnClosed
it is terminated immediately, i.e. there is no longer a consumer of the bounded channelconnThunks
.The second point in turn leads to the
BlockedIndefinitelyOnMVar
exception if the bounded channel becomes full. This can happen if the results ofrecv
calls are not evaluated fast enough withinrunRedis
. If we change the test case to force evaluation to HNF we get instead:Forcing the evaluation evaluates
errConnClosed
(= throwIO ConnectionLost
) withinrunRedis
immediately which then guarantees that the connection is closed and the evaluation thread killed.That being said it seems that using
seq
would destroy the pipelining property so maybe instead the evaluation thread should catch exceptions to guarantee there is always a consumer ofconnThunks
as long as the connection is in use?