[zeromq-dev] assertion failed in zmq::context_t::~context_t()

Ilja Golshtein ilejncs at narod.ru
Mon Jun 3 18:37:44 CEST 2013


Hello.

Application http://pastebin.com/8MRQauSq
more or less reliably crashes
with following backtrace

(gdb) bt
#0  0x00002b37406c42c5 in raise () from /lib64/libc.so.6
#1  0x00002b37406c5d70 in abort () from /lib64/libc.so.6
#2  0x00002b37406bd746 in __assert_fail () from /lib64/libc.so.6
#3  0x00000000004016ce in zmq::context_t::~context_t (this=0x7fffbfdbf900, 
    __in_chrg=<value optimized out>) at /usr/include/zmq.hpp:226
#4  0x0000000000401464 in main ()
    at /home/ilya_golshtein/projects/zeromq-play/homicide.cpp:45


if compiled with NDEBUG.

The issue is obvious and caused by this code

        inline ~context_t ()
        {
            if (ptr == NULL)
                return;
            int rc = zmq_term (ptr);
            ZMQ_ASSERT (rc == 0);
        }

According to manual, zmq_term can return non-zero in certain legitimate conditions,
and I don't quite understand why we assert that it is zero.

This is about 2.2.0, while 2.2.2, at first glance, is affected as well.

Should I provide patches?

Thanks.


dev:~/projects/zeromq-play >rpm -qa | grep zeromq
zeromq-devel-2.2.0-1
zeromq-debuginfo-2.2.0-1
zeromq-2.2.0-1
dev:~/projects/zeromq-play >uname -a
Linux dev 2.6.18-348.3.1.el5 #1 SMP Mon Mar 11 19:39:25 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
dev:~/projects/zeromq-play >cat /etc/redhat-release 
CentOS release 5.9 (Final)


-- 
Best regards
Ilja Golshtein



More information about the zeromq-dev mailing list