New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failed: (src/mailbox.cpp:99) #3313

Closed
paololucente opened this Issue Nov 21, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@paololucente
Copy link

paololucente commented Nov 21, 2018

Issue description

I'm from a project called pmacct ( https://github.com/pmacct/pmacct ) which can optionally make use of ZeroMQ for passing messages internally. I got three reports in the last three weeks of users compiling pmacct against ZeroMQ 4.2.5 and getting a failed assertion message back:

shell> nfacctd -f ./nfacctd.detailed.conf
Assertion failed: ok (src/mailbox.cpp:99)
Aborted (core dumped)

Only an hint: one of the users made some testing and apparently all works well with up to gcc6. But compiling with gcc7 or gcc8 shows the above issue.

Environment

  • libzmq version: 4.2.5
  • OS: Debian 10, Ubuntu 18.04

Minimal test code / Steps to reproduce the issue

  1. apt-get install libpcap-dev pkg-config libtool autoconf automake bash
  2. compile and install ZeroMQ 4.2.5
  3. git clone https://github.com/pmacct/pmacct.git
  4. cd pmacct ; ./autogen ; ./configure --enable-zmq; make ; make install
  5. Edit a nfacctd.conf file, put inside the following line:
    plugin_pipe_zmq: true
  6. Start pmacct: nfacctd -f /path/to/nfacctd.conf
  7. It should pretty much immediately show the failed assertion message

What's the actual result? (include assertion message & call stack if applicable)

gdb /usr/local/sbin/nfacctd core
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
< .. cut .. >
Reading symbols from /usr/local/sbin/nfacctd...done.
[New LWP 6120]
[New LWP 6118]
[New LWP 6117]
[New LWP 6119]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `nfacctd: Core Process [detailed] '.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51    ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f209000d700 (LWP 6120))]
(gdb) where
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007f2092961801 in __GI_abort () at abort.c:79
#2  0x00007f20936b1529 in ?? () from /usr/lib/x86_64-linux-gnu/libzmq.so.5
#3  0x00007f20936b60b4 in ?? () from /usr/lib/x86_64-linux-gnu/libzmq.so.5
4  0x00007f20936da472 in ?? () from /usr/lib/x86_64-linux-gnu/libzmq.so.5
#5  0x00007f20936daf36 in ?? () from /usr/lib/x86_64-linux-gnu/libzmq.so.5
#6  0x00007f20936fb5e9 in ?? () from /usr/lib/x86_64-linux-gnu/libzmq.so.5
#7  0x00007f20936fb669 in zmq_recv () from /usr/lib/x86_64-linux-gnu/libzmq.so.5
#8  0x000055ec462a574c in p_zmq_recv_str(sock=sock@entry=0x55ec4657fec8 <channels_list+7432>) at zmq_common.c:460
#9  0x000055ec462a58bb in p_zmq_zap_handler (zh=0x55ec4657fec0 <channels_list+7424>) at zmq_common.c:518
#10 0x00007f20936ef554 in ?? () from /usr/lib/x86_64-linux-gnu/libzmq.so.5
#11 0x00007f2092d196db in start_thread (arg=0x7f209000d700) at pthread_create.c:463
#12 0x00007f2092a4288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)

@bluca

This comment has been minimized.

Copy link
Member

bluca commented Nov 21, 2018

are you using a socket from multiple threads?

@paololucente

This comment has been minimized.

Copy link

paololucente commented Nov 21, 2018

Yes and no. zmq_socket() is called in one thread, followed-up by a call zmq_threadstart() passing the socket as argument; then only that specific thread uses the created socket. Effectively the issue happens on trying to read for the first time from the socket in the thread. I will correct the issue, test all and report back. Thanks, Paolo

@bluca

This comment has been minimized.

Copy link
Member

bluca commented Nov 21, 2018

ok, I'll close this in the meanwhile, reopen it if when the socket is opened and used from a single thread only it still happens

@bluca bluca closed this Nov 21, 2018

@paololucente

This comment has been minimized.

Copy link

paololucente commented Nov 23, 2018

Hi @bluca ,

Unfortunately the change did not help. Just FYI this is the patch i made ( pmacct/pmacct@b1b61ce ) but it still bails out on the same call as before, that is, the first use of the socket inside p_zmq_zap_handler().

Is it possible it does not like that the socket is part of a structure passed as argument of zmq_threadstart() - even if never used/initialised/touched outside the thread itself?

Paolo

paololucente added a commit to pmacct/pmacct that referenced this issue Nov 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment