Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XREP+XREP identity issue #82

Closed
miasscerber opened this issue Sep 17, 2010 · 6 comments
Closed

XREP+XREP identity issue #82

miasscerber opened this issue Sep 17, 2010 · 6 comments

Comments

@miasscerber
Copy link

I connect XREP to XREP. Both of them have identities to let me route messages.
The issue is that socket that binds does not use specified identity, but uses generated UUID.

#include "zhelpers.h"

int main () {
    void *context = zmq_init (1);

    void *worker = zmq_socket (context, ZMQ_XREP);
    zmq_setsockopt (worker, ZMQ_IDENTITY, "worker", 6);
    zmq_bind (worker, "inproc://routing");

    void *server = zmq_socket (context, ZMQ_XREP);
    zmq_setsockopt (server, ZMQ_IDENTITY, "server", 6);
    zmq_connect (server, "inproc://routing");

    s_sendmore (worker, "server");
    s_sendmore (worker, "");
    s_send     (worker, "workload");

    // server gets worker UUID instead of "worker", delimiter, and workload
    // we could remember workers UUID and use it to send messages to it
    s_dump (server);

    zmq_term (context);
    return 0;
}
@hintjens
Copy link
Member

Problem confirmed on 2.0.9, maint, and master branches.

@hintjens
Copy link
Member

More detail on this issue:

  • It only fails with the inproc: transport, ipc and tcp work
  • Using tcp or ipc, the program must pause before sending the first message since the identity is not otherwise correctly set-up

See test case at http://gist.github.com/593867.

  • Changing endpoint to inproc, and it produces wrong incoming identity.
  • Remove sleep(1) and it drops message (wrong outgoing identity).
  • Remove sleep(1) and change endpoint to inproc, and it produces wrong incoming identity.

@sustrik
Copy link
Member

sustrik commented Sep 29, 2010

Ack. Inproc transport doesn't exchange identities. Instead UUIDs are generated. Should be fixed.

@metasync
Copy link

metasync commented Mar 1, 2011

I encountered the same issue in 2.1.1 (RC1). Any idea when this issue is going to fix? Thanks a lot!

@sustrik
Copy link
Member

sustrik commented Mar 1, 2011

Fixed in master (4c74462).

@metasync
Copy link

metasync commented Mar 1, 2011

oh, great! thanks a lot sustrik for the quick update! will try out the master branch.

drahosp pushed a commit to LuaDist/libzmq that referenced this issue Feb 13, 2014
benjdero pushed a commit to benjdero/libzmq that referenced this issue Feb 20, 2023
bluca pushed a commit that referenced this issue Oct 31, 2023
The Intel compiler complains about the order of "static" and "const". The fix is a simple switch to one line in one header file.

In file included from ipc_listener.cpp(29):
stream_engine.hpp(97): error #82: storage class is not first
          const static size_t greeting_size = 12;
bluca pushed a commit that referenced this issue Oct 31, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants