Affects Version/s: None
Fix Version/s: 1.6
Sprint:EV 18.14 Monitoring/Stability
The peersWithoutRemotes ZStack class member is a set of idents got from received messages (used in DEALER-ROUTER ZMQ pattern to distinguish clients during sending replies).
There are two purposes of peersWithoutRemotes usage:
1) it is an old mechanism to tell connected clients about changed pool membership;
2) to interrupt sending of answer to client in case of propagated request (in this case ZMQ does not have corresponding ident in inner routing table).
Regarding the first option: new SDK client does not use such mechanism.
Regarding the second option: it is absolutely safe to send message to unknown ident using ZMQ. If ident is not known then such message is silently dropped by ZMQ, reference:
So there is no ZMQ crashes or memory leaks here, it is up to ZMQ to drop such messages, we don't need to control this on our application level.
Usage of peersWithoutRemotes is not just useless, but rather dangerous especially taking into account new SDK client behaviour of keeping connections. Now each new ident is added to peersWithoutRemotes but never removed. Moreover, we can not detect disconnection of particular ident even having disconnected event as we can not match fds and idents, ZMQ does not provide such mechanism. So it is always memory leak. Since now new SDK client implements pretty fast rotation of idents that makes described memory leak even faster.
That's why we should get reed of peersWithoutRemotes usage.