[zeromq-dev] C++ - Poll multiple sockets in different classes
Pieter Hintjens
ph at imatix.com
Wed Oct 6 13:57:15 CEST 2010
Piero,
I'd suggest that you take your code and strip it down to a minimal
test case, retesting each time to make sure the problem is still
there. 90% likely you'll find what the cause is, and it'll be
something in your code.
-Pieter
On Wed, Oct 6, 2010 at 1:35 PM, Piero Cornice
<piero.cornice at provision-comm.com> wrote:
> On 06/10/10 12:21, Pieter Hintjens wrote:
>
> Piero,
>
> What version or branch of 0MQ are you using?
>
> -Pieter
>
> I've tried Linux versions 2.0.7, 2.0.9 and development (cloned yesterday's
> zeromq2 repo).
>
> There may be something wrong with my code, but can't see what.
>
> On Wed, Oct 6, 2010 at 11:10 AM, Piero Cornice
> <piero.cornice at provision-comm.com> wrote:
>
> Hi everyone,
>
> I'm writing a TCP server to which I can "plug" multiple TCP sockets at
> runtime.
>
> The structure is pretty simple. There's a "MultiServer" class (the actual
> server) and a "TCPListener" class, which contains a TCP socket. The Server
> creates a ZMQ context, passes it to a Listener [setup()] and then polls all
> listeners' [receive()].
>
> The problem is that I'm getting a segmentation fault on the poll(), see
> below for GDB output.
> Here's a snippet demonstrating my problem: http://pastebin.com/tckkL1FW.
>
> Any hint will be much appreciated, thank you.
>
> --- GDB output ---
>
> [Thread debugging using libthread_db enabled]
> [New Thread 0x7ffff7d8a710 (LWP 20509)]
> [TCP] Binding to tcp://*:25000
> [+] Added TCPListener ffffdd30 (socket: 6063a0)
> [ ] Polling 1 listener(s)...
> [0] { 6063a0 | 0 | 1 | 0 }
>
> Program received signal SIGSEGV, Segmentation fault.
> zmq::signaler_t::get_fd (this=0x30) at signaler.cpp:38
> 38 {
> (gdb) bt
> #0 zmq::signaler_t::get_fd (this=0x30) at signaler.cpp:38
> #1 0x00007ffff7dc0935 in zmq_poll (items_=0x7fffffffdc60,
> nitems_=<value optimized out>, timeout_=-1) at zmq.cpp:421
> #2 0x00000000004022eb in zmq::poll(zmq_pollitem_t*, int, long) ()
> #3 0x0000000000401eeb in MultiServer::receive(long) ()
> #4 0x0000000000402034 in main ()
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
--
-
Pieter Hintjens
iMatix - www.imatix.com
More information about the zeromq-dev
mailing list