You should at least use the standard valgrind suppression file that's
included in most ZeroMQ C/C++ projects.

{
   <socketcall_sendto>
   Memcheck:Param
   socketcall.sendto(msg)
   fun:send
   ...
}
{
   <socketcall_sendto>
   Memcheck:Param
   socketcall.send(msg)
   fun:send
   ...
}

Then, if you're getting errors on a basic test case, it is due to
application code (we regularly run libzmq and czmq through valgrind).

-Pieter

On Thu, Sep 25, 2014 at 9:45 AM, Carlos Tangerino
<carlos.tanger...@gmail.com> wrote:
> Not sure if someone has noticed that but I for this message when I create a
> SUB/PUB broker
>
>
> ==6536== Invalid write of size 4
> ==6536==    at 0x4135C6B: zmq::pipe_t::set_hwms(int, int) (pipe.cpp:483)
> ==6536==    by 0x411FED4:
> zmq::ctx_t::connect_inproc_sockets(zmq::socket_base_t*, zmq::options_t&,
> zmq::pending_connection_t&, zmq::ctx_t::side) (ctx.cpp:476)
> ==6536==    by 0x412445C: zmq::ctx_t::connect_pending(char const*,
> zmq::socket_base_t*) (ctx.cpp:435)
> ==6536==    by 0x413214D: zmq::object_t::connect_pending(char const*,
> zmq::socket_base_t*) (object.cpp:162)
> ==6536==    by 0x4141D6B: zmq::socket_base_t::bind(char const*)
> (socket_base.cpp:347)
> ==6536==    by 0x415431F: zmq_bind (zmq.cpp:309)
> ==6536==    by 0x8053A3D: zmqBroker (broker.c:225)
> ==6536==    by 0x8054114: broker (broker.c:592)
> ==6536==    by 0x80587DE: main (ce50.c:468)
> ==6536==  Address 0xa610b94 is 52 bytes inside a block of size 104 free'd
> ==6536==    at 0x402B838: operator delete(void*) (in
> /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
> ==6536==    by 0x41351C3: zmq::pipe_t::~pipe_t() (pipe.cpp:87)
> ==6536==    by 0x4134E72: zmq::pipe_t::process_pipe_term_ack()
> (pipe.cpp:334)
> ==6536==    by 0x4131F7F: zmq::object_t::process_command(zmq::command_t&)
> (object.cpp:107)
> ==6536==    by 0x413E65F: zmq::socket_base_t::process_commands(int, bool)
> (socket_base.cpp:904)
> ==6536==    by 0x4142B4F: zmq::socket_base_t::in_event()
> (socket_base.cpp:1005)
> ==6536==    by 0x4128A48: zmq::epoll_t::loop() (epoll.cpp:165)
> ==6536==    by 0x414C2BF: thread_routine (thread.cpp:81)
> ==6536==    by 0x409BF6F: start_thread (pthread_create.c:312)
> ==6536==    by 0x426788D: clone (clone.S:129)
> ==6536==
> ==6536== Invalid write of size 4
> ==6536==    at 0x4135C72: zmq::pipe_t::set_hwms(int, int) (pipe.cpp:484)
> ==6536==    by 0x411FED4:
> zmq::ctx_t::connect_inproc_sockets(zmq::socket_base_t*, zmq::options_t&,
> zmq::pending_connection_t&, zmq::ctx_t::side) (ctx.cpp:476)
> ==6536==    by 0x412445C: zmq::ctx_t::connect_pending(char const*,
> zmq::socket_base_t*) (ctx.cpp:435)
> ==6536==    by 0x413214D: zmq::object_t::connect_pending(char const*,
> zmq::socket_base_t*) (object.cpp:162)
> ==6536==    by 0x4141D6B: zmq::socket_base_t::bind(char const*)
> (socket_base.cpp:347)
> ==6536==    by 0x415431F: zmq_bind (zmq.cpp:309)
> ==6536==    by 0x8053A3D: zmqBroker (broker.c:225)
> ==6536==    by 0x8054114: broker (broker.c:592)
> ==6536==    by 0x80587DE: main (ce50.c:468)
> ==6536==  Address 0xa610b90 is 48 bytes inside a block of size 104 free'd
> ==6536==    at 0x402B838: operator delete(void*) (in
> /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
> ==6536==    by 0x41351C3: zmq::pipe_t::~pipe_t() (pipe.cpp:87)
> ==6536==    by 0x4134E72: zmq::pipe_t::process_pipe_term_ack()
> (pipe.cpp:334)
> ==6536==    by 0x4131F7F: zmq::object_t::process_command(zmq::command_t&)
> (object.cpp:107)
> ==6536==    by 0x413E65F: zmq::socket_base_t::process_commands(int, bool)
> (socket_base.cpp:904)
> ==6536==    by 0x4142B4F: zmq::socket_base_t::in_event()
> (socket_base.cpp:1005)
> ==6536==    by 0x4128A48: zmq::epoll_t::loop() (epoll.cpp:165)
> ==6536==    by 0x414C2BF: thread_routine (thread.cpp:81)
> ==6536==    by 0x409BF6F: start_thread (pthread_create.c:312)
> ==6536==    by 0x426788D: clone (clone.S:129)
>
> static void zmqBroker(void) {
>     int rc;
>     int linger = 1000;
>
>     if (gDebug & DEB_ZMQ) log_info("ZMQ thread running");
>     void *frontend = zmq_socket(zmq_ctx, ZMQ_XSUB);
>     if (frontend == NULL) {
>         log_info ("Bad socket %s", zmq_strerror(errno));
>     }
>     assert(frontend);
>     zmq_setsockopt(frontend, ZMQ_LINGER, &linger, sizeof (linger));
>     rc = zmq_bind(frontend, "inproc://localhost:10000");
>     if (rc) {
>         log_err("Bind error");
>         assert(rc == 0);
>     }
>     void *backend = zmq_socket(zmq_ctx, ZMQ_XPUB);
>     assert(backend);
>     zmq_setsockopt(backend, ZMQ_LINGER, &linger, sizeof (linger));
>     rc = zmq_bind(backend, "inproc://localhost:10001”); // this is the line
> 225!
>     assert(rc == 0);
>     zmq_proxy(frontend, backend, NULL);
>
>     zmq_close(frontend);
>     zmq_close(backend);
>     log_info("ZMQ thread ended");
> }
>
>
> Carlos Tangerino
> carlos.tanger...@gmail.com
>
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to