相关文章推荐

IPC sockets do not reconnect to active bind #2764

Closed
@Kentzo

Description

Please use this template for reporting suspected bugs or requests for help.

Issue description

Environment

  • libzmq version (commit hash if unreleased): 4.1.6
  • OS: macOS 10.12.6
  • pyzmq: 16.0.2
  • Minimal test code / Steps to reproduce the issue

    Here are 2 python files:

    # pub.py
    import zmq
    import time
    c = zmq.Context.instance()
    s = c.socket(zmq.PUB)
    s.bind('ipc:///tmp/socket')
    time.sleep(10)  # helps to run 2 processes simultaneously
    s.send(b'42')
    # sub.py
    import zmq
    c = zmq.Context.instance()
    s = c.socket(zmq.SUB)
    s.subscribe('')
    s.connect('ipc:///tmp/socket')
    while True:
        print(s.recv())

    To reproduce the issue:

  • Run sub.py
  • Run 2 pub.py simultaneously
  • What's the actual result? (include assertion message & call stack if applicable)

    sub.py received only one message (expected), but subsequent calls to pub.py will not cause sub.py to receive anything.

    What's the expected result?

    sub.py should notice that previously connected socket is closed, reconnect, and be able to receive messages from subsequent pub.py .

     
    推荐文章