Uploaded image for project: 'Indy Node'
  1. Indy Node
  2. INDY-1467

Get rid of peersWithoutRemotes

    XMLWordPrintable

Details

    • Task
    • Status: Complete
    • High
    • Resolution: Done
    • None
    • 1.6
    • None
    • None

    Description

      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:

      http://zguide.zeromq.org/page%3aall#ROUTER-Error-Handling

      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.

      Attachments

        Activity

          People

            zhigunenko.dsr NIkita Zhigunenko
            sergey-shilov Sergey Shilov
            NIkita Zhigunenko, Sergey Shilov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: