My program uses ZMQ for communication. Namely, a server (C++, linux) creates an XPUB socket and then in one thread reads it, and in another one publishes data (writes).
The client (java, jzmq, linux) create a SUB socket, and subscribes using it.
After some time, the server side receives SIGABRT in the reading thread.
What may be a source of problem? Read/Write in different threads or creating XPUB/SUB pair?
In case the problem is in multi threading, what is a right paradigm to use XPUB socket?
https://zguide.zeromq.org/docs/chapter2/#Multithreading-with-ZeroMQ
Don’t share ZeroMQ sockets between threads. ZeroMQ sockets are not threadsafe. Technically it’s possible to migrate a socket from one thread to another but it demands skill. The only place where it’s remotely sane to share sockets between threads are in language bindings that need to do magic like garbage collection on sockets.