libzmq
  1. libzmq
  2. LIBZMQ-270

A SUB socket with a message in queue should always have ZMQ_POLLIN set

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: core
    • Labels:
    • Environment:

      OSX, Linux

      Description

      When checking for events on a SUB socket with zmq_getsockopt(sock, ZMQ_EVENTS, &events, &size), the events variable should be set to ZMQ_POLLIN. In 3.0, it is set to 0.

      This only occurs when the SUB socket binds and the PUB connects. If you swap the bind/connect on the sockets, it works.

      This same code works in 2.1.x regardless of the order of bind/connect.

      (issue has been committed to the issues repository.)

        Activity

        Chuck Remes created issue -
        Chuck Remes made changes -
        Field Original Value New Value
        Priority Minor [ 4 ] Critical [ 2 ]
        Chuck Remes made changes -
        Priority Critical [ 2 ] Major [ 3 ]
        Pieter Hintjens made changes -
        Comment [ Here is a workaround that works:

        - use XSUB instead of SUB
        - after XSUB connects allow 20 msec for connection to establish
        - send subscription manually, as message starting with 0x01
        - allow 20 msec for publisher to receive subscription (if you need to synch it)
        ]
        Pieter Hintjens made changes -
        Comment [ Sadly the workaround doesn't work consistently... :-/ ]

          People

          • Assignee:
            Martin Sustrik
            Reporter:
            Chuck Remes
          • Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated: