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

Weird NPE on pub socket #76

Closed
MichaelScofield opened this issue Jul 15, 2013 · 11 comments
Closed

Weird NPE on pub socket #76

MichaelScofield opened this issue Jul 15, 2013 · 11 comments

Comments

@MichaelScofield
Copy link

This was my pseudo code in the beginning (in an singleton service object):
pub = ctx.createSocket(ZMQ.PUB);
pub.bind("tcp://*.5556");
While(!stop) {
MyObject o = aConcurrentQueue.poll()
if (o != null) {
pub.sendMore(e.getTopic());
pub.send(e.getBody());
} else {
Thread.sleep(10);
}
}
However, it produced NPE like:
java.lang.NullPointerException
at zmq.Mtrie.match(Mtrie.java:353)
at zmq.XPub.xsend(XPub.java:179)
at zmq.SocketBase.send(SocketBase.java:598)
at org.zeromq.ZMQ$Socket.send(ZMQ.java:1002)
at org.zeromq.ZMQ$Socket.send(ZMQ.java:988)
(btw, I'm using jeromq 0.3.0)
Can't really figure out why this happened, any help would be thankful!

@miniway
Copy link
Member

miniway commented Jul 15, 2013

Could you please post your SUB part of the failed case?

@MichaelScofield
Copy link
Author

@miniway
thx for the comment, but the SUB part code is that I can't access, nor control. All I know about it is just simple straightforward connect, subscribe and unsubscribe :(
I read the source code of Mtrie.java, and line 353 is: if (current.pipes != null)
Sorry I really don't get it under what circumstance will the var "current" be NULL...

@miniway
Copy link
Member

miniway commented Jul 15, 2013

Please try with a modified jar, https://www.dropbox.com/s/7xvbttps35a0j5b/jeromq-0.3.0-SNAPSHOT.jar

It contains a fix at the Mtrie.java. If it fixes your problem, I'm going to publish the fix to public.

@MichaelScofield
Copy link
Author

ok, I'll try this new jar, thx~

@MichaelScofield
Copy link
Author

still remains the problem... :(

@miniway
Copy link
Member

miniway commented Jul 15, 2013

:(
So, what kinds of topics? If I know the exact list of topics it would be helpful, because the Mtrie builds trees one character by one. And how many client usually connect?

@miniway
Copy link
Member

miniway commented Jul 15, 2013

Please try it once more with https://www.dropbox.com/s/7xvbttps35a0j5b/jeromq-0.3.0-SNAPSHOT.jar

The url is the same before but the file has an another fix.

@MichaelScofield
Copy link
Author

The topics are like "ping", "chat" etc., just a fixed set of Strings. I'll test on the new jar, hope it'll work :)

@MichaelScofield
Copy link
Author

have run the new jar for a day without the NPE, thought it ok, thx~

@MichaelScofield
Copy link
Author

it would be nicer if u merge the change to the master, so I don't need to maintain the jar myself instead of maven~

miniway added a commit to miniway/jeromq that referenced this issue Jul 17, 2013
@miniway
Copy link
Member

miniway commented Jul 18, 2013

I've also updated the jeromq-0.3.0-SNAPSHOT at sonatype. Your maven will download the latest jar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants