Uploaded image for project: 'libzmq'
  1. libzmq
  2. LIBZMQ-207

'Assertion failed: rc == 0 (zmq_connecter.cpp:48)'

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      I got a 'Assertion failed: rc == 0 (zmq_connecter.cpp:48)'
      When I accidentally used "tcp://localhost:localhost" in a connect.

        Activity

        Hide
        leojay Leo Jay added a comment -

        Thanks for your reply.
        I think I get your point, but even if we cannot return an error code, is it possible make it not crash first?
        I mean can we just remove the assertion?
        It's annoying that the program crashes when network is unavailable.

        You can try this small python script with your network cable unplugged. The program crashes every time.

        import zmq
        ctx = zmq.Context()
        s = ctx.socket(zmq.REQ)
        s.connect('tcp://www.google.com:12345')    # domain name doesn't matter when network is unavailable
        s.send('hi')
        print s.recv()

        I don't know if you agree with me that as a library, you shouldn't crash the whole program, at least give the program a chance to handle exceptions.
        Thanks.

        Show
        leojay Leo Jay added a comment - Thanks for your reply. I think I get your point, but even if we cannot return an error code, is it possible make it not crash first? I mean can we just remove the assertion? It's annoying that the program crashes when network is unavailable. You can try this small python script with your network cable unplugged. The program crashes every time. import zmq ctx = zmq.Context() s = ctx.socket(zmq.REQ) s.connect('tcp: //www.google.com:12345') # domain name doesn't matter when network is unavailable s.send('hi') print s.recv() I don't know if you agree with me that as a library, you shouldn't crash the whole program, at least give the program a chance to handle exceptions. Thanks.
        Hide
        pieterh Pieter Hintjens added a comment -

        Leo, I've pushed a fix for this to 2-1 master (at https://github.com/zeromq/zeromq2-1), can you test it?

        Show
        pieterh Pieter Hintjens added a comment - Leo, I've pushed a fix for this to 2-1 master (at https://github.com/zeromq/zeromq2-1 ), can you test it?
        Hide
        leojay Leo Jay added a comment -

        Yes, it works. Thank you.

        Show
        leojay Leo Jay added a comment - Yes, it works. Thank you.
        Hide
        leojay Leo Jay added a comment -

        Hi, do you think it would be better if the error message is connection error/DNS error or something else instead of invalid argument?

        Show
        leojay Leo Jay added a comment - Hi, do you think it would be better if the error message is connection error/DNS error or something else instead of invalid argument?
        Hide
        pieterh Pieter Hintjens added a comment -

        I assume we'll get either EAI_NONAME or EAI_NODATA (at least on POSIX boxes) from getaddrinfo() if it fails. Do you have any suggestions for errno's to use in these cases? The code is in ip.cpp:337.

        Show
        pieterh Pieter Hintjens added a comment - I assume we'll get either EAI_NONAME or EAI_NODATA (at least on POSIX boxes) from getaddrinfo() if it fails. Do you have any suggestions for errno's to use in these cases? The code is in ip.cpp:337.

          People

          • Assignee:
            pieterh Pieter Hintjens
            Reporter:
            dantman dantman
          • Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: