Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:49
    sab24 commented #3366
  • Jan 22 21:21
    bill-torpey commented #4053
  • Jan 19 00:51
    yaoyuande commented #1835
  • Jan 19 00:49
    yaoyuande commented #1835
  • Jan 18 09:43
    bluca commented #4123
  • Jan 18 09:42

    bluca on master

    Problem: test_pubsub broken eve… (compare)

  • Jan 18 09:11
    mjvankampen synchronize #4125
  • Jan 18 08:42
    bluca commented #4123
  • Jan 18 08:42

    bluca on master

    Problem: norm fails to compile … (compare)

  • Jan 18 08:42
    bluca closed #4123
  • Jan 18 08:42
    bluca closed #1863
  • Jan 18 07:39
    mjvankampen synchronize #4125
  • Jan 18 07:33
    mjvankampen synchronize #4125
  • Jan 18 07:04
    JackBoosY commented #3366
  • Jan 18 06:33
    mjvankampen commented #4123
  • Jan 17 18:50
    bluca commented #4123
  • Jan 17 18:41
    mjvankampen commented #4123
  • Jan 17 18:40
    mjvankampen commented #4123
  • Jan 17 16:21
    bluca commented #4123
  • Jan 17 16:03
    bluca commented #4123
Allie
@cite-reader

"Socket operation on non-socket" ought to be totally impossible given Java's type safety. That's telling me your program has some kind of undefined behavior, probably a data race: uncoordinated access to a shared variable. Without seeing the code I can't guess where it is. I'm not primarily a Java developer so I can't suggest tools for automatically detecting them.

Alternatively, this means the jzmq wrapper is totally hosed. I doubt it but who knows.

priyanshu850
@priyanshu850
I see, i will look into my code and will check about data race.
and any idea about this error
org.zeromq.ZMQException: Invalid argument at org.zeromq.ZMQ$Poller.run_poll(Native Method) ~[zmq-3.1.0.jar:?] at org.zeromq.ZMQ$Poller.poll(ZMQ.java:2136) ~[zmq-3.1.0.jar:?] at com.d.b(Unknown Source) ~[cx-dev.4.0.6.jar:?] at com.s.b.run(Unknown Source) ~[cx-dev.4.0.6.jar:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_265] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_265] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_265] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_265] at java.lang.Thread.run(Thread.java:7
@cite-reader
Allie
@cite-reader
If my read of the source is correct (and it might not be) the only way for a Poller.poll call to complain about an invalid argument is for one of the registered poll arguments to have been invalidated--either the socket is null or the file descriptor is invalid. I think that indicates API misuse; you're supposed to remove a socket from all pollers it's registered with before closing it, which seems like the most likely way to provoke that.
priyanshu850
@priyanshu850
ok, Thank you very much
xkungfu
@xkungfu

`class socketPool
{
std::string endpoint;
public:
socketPool(const std::string &ep) : endpoint
(ep) {}
zmq::socket_t & operator()()
{
thread_local static zmq::socket_t socket(
globalContext(),
ZMQ_REQ);
thread_local static bool connected;

    if (!connected) {
        connected = true;
        socket.connect(endpoint_);
    }

    return socket;
}

};

// creating a pool for each endpoint
socketPool httpReqPool("ipc://http-concentrator");`

I found the code above from https://stackoverflow.com/questions/41941702/one-zeromq-socket-per-thread-or-per-call

I can't understand what is "globalContext()".

can you tell me? thanks a lot!

Allie
@cite-reader
It's a placeholder that the original poster used in their "half-C++ half-pseudo-code" example as a placeholder for "whatever code needed to get our hands on the program's ZMQ context." In real code you probably just take the context as an argument, possibly as part of a larger "application state" structure.
Simon Giesecke
@sigiesec
Hi :) When working on the test coverage job, I wondered why IPv6=ON in the .travis.yml has no effect. On the one hand, it seems that there is actually nothing that uses this flag. But what's worse is that apparently since end of 2018, there is no support for IPv6 on any amd64 machine on travis-ci anymore, according to https://docs.travis-ci.com/user/reference/overview/#virtualisation-environment-vs-operating-system. But there are now arm64/ppc64le/s390x machines, which support IPv6. We should probably run tests there as well, including at least one coverage job, so we can actually see how IPv6 code is covered. I will try to make that work.
1 reply
kassem-tohme
@kassem-tohme
Hey all, I am currently working on a project (C++, using cppzmq) and I need to implement authentication for each zmq client connecting to a socket (PUB/SUB). As already stated in zeromq/cppzmq#409, there is a lack of documentation on showing how to use the PLAIN or CURVE protocols in cppzmq. Can anyone provide me a minimal working authentication example or point me to some source code providing more information? Thanks in advance!
xkungfu
@xkungfu
@cite-reader in these days I studied more about beast, and understand some of that. and now I can write code and it running correctly. thank you very much!
mental
@mental32
Hey folks - could someone help me understand if its possible to get the ROUTING_ID of a ZMQ_DEALER client when it connects to a ZMQ_ROUTER server with a socket monitor active for all events? currently on ZMQ_EVENT_ACCEPTED and ZMQ_EVENT_DISCONNECTED only a file descriptor value is given back but I can't figure out what/why I would use it.
Kevin Sapper
@sappo
@mental32 this is not possible afaik. Usually the dealer side sends a hello message to introduce itself.
Allie
@cite-reader
It's possible if you build a libzmq with draft APIs: the ZMQ_ROUTER_NOTIFY socket option (set on the router side) can be set to ZMQ_NOTIFY_CONNECT to deliver "a zero-length message" when the ZMTP connection completes, with the usual routing frame prepended. This shows up in the stream of messages received from the socket, not on any associated monitor sockets.
Allie
@cite-reader
@kassem-tohme My C++ is not great, but I have a working PLAIN server if you want to look at it, here:
https://code.historical-reasons.dev/authpub
mental
@mental32
Would anyone know if the endianess of the bytes in the zmq_socket_monitor event/value frame are stable? I just figured out that on my machine the integers were little but I'm not sure if they're always going to be little endian on all machines or if its depended on the target architecture
Allie
@cite-reader
It's native-endian. Reading the source you can see that the message data is written by memcpy from fixed size integers.
xjfang91
@xjfang91
Have you ever experienced zmq crash after running in some system environments for some times?
xjfang91
@xjfang91
The exception is triggered every 2 hours of operation.
Potato He
@netpotato
Hello, where can find libzmq-v110-4_0_4,who can talk to me?
priyanshu850
@priyanshu850
@xjfang91 what error you are getting ?
mental
@mental32
Could anyone point me to the docs or an example where I could understand how a PUB/SUB topic filter would work for multipart messages? I've got a message that is typically two frames wide (and I'm not worried about adding a third frame to specify the topic if that's needed) but my question is "how" can I get the SUB to filter a specific frame or which frame does the SUB socket automatically filter so I can shift my data accordingly
Allie
@cite-reader
Subscriptions are a prefix match on the first frame.
That's in the Guide
mental
@mental32
@cite-reader thank you! <3
degeorg
@degeorg
Hi! Working on project, trying to implement n to n topology. Currently thinking about this: DEALER (client) <-> ROUTER <-> ROUTER ("broker") <-> DEALER (worker). What i need: 1. Client: connect to broker, send several requests at a time (async) and waiting responses, could work several clients at a time, also retry logic on error. 2. Worker: predefined pool of workers, each connect to broker (self registration on broker), receive requests from broker, processing and send responses back. 3. Broker: received requests from client and load-balancing (round-robin or based on load) them throught workers, then route responses back to clients, also heartbeating workers and tracking state per client request. Could someone give advice on that, is it good idea or i'am going wrong way...Thanks!
gerald-dotcom
@gerald-dotcom

The response to browser only sent if I CTRL+C the running ZeroMQ Application but I don't know why.

// Send Response socket.send(frames[0], zmq::send_flags::sndmore); socket.send(zmq::str_buffer("HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\nHello, World!"), zmq::send_flags::none); // Close Connection with Browser socket.send(frames[0], zmq::send_flags::sndmore); socket.send(zmq::buffer(std::string_view("\0")), zmq::send_flags::none);

Nassim Abedi
@nassimabedi
Hello, Could you please help me:) how send specific message size in request-reply I found ZMQ_MAXMSGSIZE but it is related to socket option . I want to send specific message size . Is it related to socket option ? or just control message size in other way?
another question how can I send huge message per second?(for example 10000 kb/p)
mental
@mental32
I may go and bench this but I think it's smart that I ask here first: Is there a performance difference between using a PUSH/PULL pair of sockets instead of a DEALER? (my gut feeling says no))
Kevin Sapper
@sappo

@mental32 There's no performance difference between them but a memory difference.

DEALER sockets create both a send and receive queue per connection.

PUSH/PULL sockets create only a single send and receive queue per connection respectively.

mental
@mental32
gotcha thanks!
zoobab "NO Software Patents"
@zoobab_twitter
hey
can you tell me if Bitcoin still uses zeromq?
@sappo @bluca I sent you an email
Kevin Sapper
@sappo

can you tell me if Bitcoin still uses zeromq?

Seems like it https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md

zoobab "NO Software Patents"
@zoobab_twitter
have you seen my email?
vote on UPC, the 3rd attempt to get swpats in Europe, is tomorrow
we will loose it
mental
@mental32

I've just noticed that libzmq sub sockets performs prefix match filtering when I use TCP, reading spec 29 the section describing the SUB socket does allow it

MAY, depending on the transport, filter messages according to subscriptions, using a prefix match algorithm.

My question is how can I know which transports libzmq will try to prefix match for? I can't find it in the documentation for setsockopt

mental
@mental32
For now I'm just going to assume it applies to all transports
priyanshu850
@priyanshu850

Hello @sappo , @cite-reader ,
could you please help me out from this problem :
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 at java.util.ArrayList.rangeCheck(ArrayList.java:659) at java.util.ArrayList.get(ArrayList.java:435) at zmq.socket.pubsub.Dist.distribute(Dist.java:162) at zmq.socket.pubsub.Dist.sendToMatching(Dist.java:138) at zmq.socket.pubsub.XPub.xsend(XPub.java:253) at zmq.SocketBase.send(SocketBase.java:718) at org.zeromq.ZMQ$Socket.send(ZMQ.java:3205) at org.zeromq.ZMQ$Socket.sendMore(ZMQ.java:3131)

I am using PUB/SUB pattern in multithreading.
When i try to publish event, i am getting this error.
using jeromq-0.5.2

import org.json.JSONObject;
import org.zeromq.SocketType;
import org.zeromq.ZContext;
import org.zeromq.ZMQ;
import org.zeromq.ZMQException;
import java.math.BigDecimal;
import java.util.Arrays;

public class RatePublisher {
    private static final ZContext context = new ZContext();
    private static final ZMQ.Socket publisher = context.createSocket(SocketType.PUB);
    private static String zmqAddress = "tcp://localhost:5563";
    static {
        publisher.bind(zmqAddress);
    }

 public static void publish(String name, String ident, BigDecimal rate, BigDecimal changePercentage) throws InterruptedException {
        try {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("name", name);
            jsonObject.put("ident", ident);
            jsonObject.put("rate", rate);
            jsonObject.put("changed_percentage", changePercentage);
           publisher.sendMore("rate");
           publisher.send(jsonObject.toString());
        } catch (ZMQException e) {
            e.printStackTrace();
            throw new InterruptedException();
        }
    }

    public static void close() throws InterruptedException {
        try {
            context.destroy();
        } catch (Exception e) {
            throw new InterruptedException();
        }
    }
}
in start of program, i initialise it.
After that Multiple thread are using this publish method.
For exapmle : Class A, B, C are working in asyncronous way and rapidily calling this publish method like this :
RatePublisher.publish("test", pair, rate, changePercentage);
Kevin Sapper
@sappo
@priyanshu850 the current zeromq sockets are not thread-safe.
Also make sure that you only have one ZContext object per JVM instance
priyanshu850
@priyanshu850
@sappo I need to publish event on a single port for example 5563, then how can i do that ?
I need this scenerio :
Class A, B, C are working in asyncronous way and calling this publish method like this :
RatePublisher.publish("test", pair, rate, changePercentage);
priyanshu850
@priyanshu850
currently doing like this
import org.json.JSONObject;
import org.zeromq.SocketType;
import org.zeromq.ZContext;
import org.zeromq.ZMQ;
import org.zeromq.ZMQException;
import java.math.BigDecimal;
import java.util.Arrays;

public class RatePublisher {
    private static final ZContext context = new ZContext();
    private static final ZMQ.Socket publisher = context.createSocket(SocketType.PUB);
    private static String zmqAddress = "tcp://localhost:5563";

   static {
        publisher.bind(zmqAddress);
    }

 public static void publish(String name, String ident, BigDecimal rate, BigDecimal changePercentage) throws InterruptedException {
        try {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("name", name);
            jsonObject.put("ident", ident);
            jsonObject.put("rate", rate);
            jsonObject.put("changed_percentage", changePercentage);
           publisher.sendMore("rate");
           publisher.send(jsonObject.toString());
        } catch (ZMQException e) {
            e.printStackTrace();
            throw new InterruptedException();
        }
    }

    public static void close() throws InterruptedException {
        try {
            context.destroy();
        } catch (Exception e) {
            throw new InterruptedException();
        }
    }
}

public class A 
{   
    public static void main(String[] args)
    {
        int i = 100;
        while(i>0) {
           RatePublisher.publish("test", pair, rate, changePercentage);
           i--;
        }
    }
}

public class B 
{   
    public static void main(String[] args)
    {
        int i = 100;
        while(i>0) {
           RatePublisher.publish("test", pair, rate, changePercentage);
           i--;
        }
    }
}

public class C 
{   
    public static void main(String[] args)
    {
        int i = 100;
        while(i>0) {
           RatePublisher.publish("test", pair, rate, changePercentage);
           i--;
        }
    }
}

public class D
{   
    public static void main(String[] args)
    {
        int i = 100;
        while(i>0) {
           RatePublisher.publish("test", pair, rate, changePercentage);
           i--;
        }
    }
}
ofc in my program i am using thread, it is similar like that
Kevin Sapper
@sappo
Either make RatePublisher.publish thread-safe or use one socket per thread (preferred)
Fialkovsky Maxim
@makometr
Hello guys, i am new to libzmq and i have a small question now: how to handle zmq-messages (from hello-world-client example) on server without zmq-wrapper, for example on standart go or python-flask server backend?
Thanks for any idea