Closed nkochakian closed 6 years ago
Hi @nkochakian,
Thanks for noticing that and reporting that, I will look into fixing that!
Best
I pushed a fix on master.
Concerning your comment related to the side effect, I did not made any change as of now as it is anyway an existing problem in previous versions, in both redis subscriber and redis client.
I will record that as a possible improvement and work on that when I can.
Best
Before reconnecting,
subscriber::connection_disconnection_handler
acquires a lock (here) to prevent access tom_subscribed_channels
. The corresponding lock form_psubscribed_channels
(m_psubscribed_channels_mutex
) is never acquired. This can cause issues later whensubscriber::re_subscribe
is called, since it modifiesm_psubscribed_channels
.A side effect of locking the channel map is that the connect callback is called in two different contexts:
subscriber::connect
with no locks acquiredsubscriber::connection_disconnection_handler
viasubscriber::reconnect
whenm_subscribed_channels_mutex
is lockedFor
#
2, callingsubscriber::subscribe
will cause a deadlock. (In the case of Visual C++ 2015, it might actually throw an exception, which is discarded by this catch all.)