Skip to content
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 in zmq::msg_t::check with Zeromq4.2.0 #2402

Closed
GodshadowLQH opened this issue Mar 20, 2017 · 6 comments
Closed

Assertion failed in zmq::msg_t::check with Zeromq4.2.0 #2402

GodshadowLQH opened this issue Mar 20, 2017 · 6 comments

Comments

@GodshadowLQH
Copy link

GodshadowLQH commented Mar 20, 2017

#0  0x0000003276c325e5 in raise () from /lib64/libc.so.6
#1  0x0000003276c33dc5 in abort () from /lib64/libc.so.6
#2  0x00007fba2234c7f9 in zmq::zmq_abort (errmsg_=0x1719 <Address 0x1719 out of bounds>) at src/err.cpp:87
#3  0x00007fba2234e70d in zmq::msg_t::size (this=0x7fb9d4313050) at src/msg.cpp:361
#4  0x00007fba223859c2 in zmq::v2_encoder_t::message_ready (this=0x7fb9d45b1da0) at src/v2_encoder.cpp:54
#5  0x00007fba2237cd08 in zmq::stream_engine_t::out_event (this=0x7fb9d4313030) at src/stream_engine.cpp:384
#6  0x00007fba2234ca44 in zmq::io_thread_t::in_event (this=0x7fba384d2010) at src/io_thread.cpp:85
#7  0x00007fba2234bf62 in zmq::epoll_t::loop (this=0x7fba384d4d60) at src/epoll.cpp:179
#8  0x00007fba22363920 in thread_routine (arg_=0x7fba384d4de0) at src/thread.cpp:100
#9  0x0000003277007aa1 in start_thread () from /lib64/libpthread.so.0
#10 0x0000003276ce8aad in clone () from `/lib64/libc.so.6

Program abort when calling zmq::msg_t::check().I select the stack frame 3, and get the value of msg_t :

{u = {base = {metadata = 0x0, unused = '\000' <repeats 33 times>, type = 0 '\000', flags = 0 '\000', 
      group = '\000' <repeats 15 times>, routing_id = 0}, vsm = {metadata = 0x0, data = '\000' <repeats 32 times>, 
      size = 0 '\000', type = 0 '\000', flags = 0 '\000', group = '\000' <repeats 15 times>, routing_id = 0}, lmsg = {
      metadata = 0x0, content = 0x0, unused = '\000' <repeats 25 times>, type = 0 '\000', flags = 0 '\000', 
      group = '\000' <repeats 15 times>, routing_id = 0}, zclmsg = {metadata = 0x0, content = 0x0, 
      unused = '\000' <repeats 25 times>, type = 0 '\000', flags = 0 '\000', group = '\000' <repeats 15 times>, routing_id = 0}, 
    cmsg = {metadata = 0x0, data = 0x0, size = 0, unused = '\000' <repeats 17 times>, type = 0 '\000', flags = 0 '\000', 
      group = '\000' <repeats 15 times>, routing_id = 0}, delimiter = {metadata = 0x0, unused = '\000' <repeats 33 times>, 
      type = 0 '\000', flags = 0 '\000', group = '\000' <repeats 15 times>, routing_id = 0}}}
@bluca
Copy link
Member

bluca commented Mar 20, 2017

This looks like an invalid message (type is 0).
The backtrace is in the encoder, so it looks like it's something created in the local application and being sent out. How is the message created? Can you share the code to reproduce it?

@GodshadowLQH
Copy link
Author

GodshadowLQH commented Mar 21, 2017

Well,I am using CZMQ-jni in java appplication.Since there is not czmq call stack ,maybe it is properly to ask for help here.It happens sometimes and I can not tell how it happens.The code is very simple . It would like this:

Zsock broadcastSock = this.context.newPub("@tcp://127.0.0.1:"+this.port);
if(broadcastSock==null || broadcastSock.self==0){
	broadcastSock = null;
	close();
	throw new Exception(MessageFormat.format("Port {0} occupied!", this.port));
}
broadcastSock.setLinger(0);
broadcastSock.setSndhwm(0);
// called when something changed
void broadcast(byte[] data){
      Zframe frame = new Zframe(data, data.length);
     frame.send(broadcastSock.self, ZFRAME_DONTWAIT);
     frame.close();
}

@bjovke
Copy link
Contributor

bjovke commented Apr 19, 2017

@GodshadowLQH Where are you calling broadcast() from? Are you checking somewhere if length of data you're sending is zero?

@sigiesec
Copy link
Member

@GodshadowLQH I am not familiar with CZMQ, but I assume you must not call frame.close after frame.send. The frame will be released internally when it has actually been sent.

@bluca
Copy link
Member

bluca commented Aug 25, 2017

Yes CZMQ will destroy the frame on a successful send like all other APIs.

@bluca
Copy link
Member

bluca commented Mar 24, 2018

Closing since the problem was the extra close()

@bluca bluca closed this as completed Mar 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants