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

periodic index-out-of-bounds error #938

Open
stealthrabbi opened this issue Jan 11, 2023 · 10 comments
Open

periodic index-out-of-bounds error #938

stealthrabbi opened this issue Jan 11, 2023 · 10 comments

Comments

@stealthrabbi
Copy link

Using v0.5.2

My program is able to run days sending binary pictures, but will occasionally encounter an IndexOutOfBoundsException. I am not sure if it's an apparent issue with the data being sent to the zmq client, or something with a connection. The issue is not easily repeatable.

Also, are there release notes for different versions? I see there's now a 0.5.3, but I can't tell what's been added to it.

Exception in thread "My Thread" Exception in thread "My Thread" java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
        at java.base/jdk.internal.util.Preconditions.outOfBounds(Unknown Source)
        at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Unknown Source)
        at java.base/jdk.internal.util.Preconditions.checkIndex(Unknown Source)
        at java.base/java.util.Objects.checkIndex(Unknown Source)
        at java.base/java.util.ArrayList.get(Unknown Source)
        at zmq.socket.pubsub.Dist.distribute(Dist.java:162)
        at zmq.socket.pubsub.Dist.sendToMatching(Dist.java:138)
        at zmq.socket.pubsub.XPub.xsend(XPub.java:253)
        at zmq.SocketBase.send(SocketBase.java:718)
        at org.zeromq.ZMQ$Socket.send(ZMQ.java:3205)
        at org.zeromq.ZFrame.send(ZFrame.java:136)
        at org.zeromq.ZFrame.sendAndKeep(ZFrame.java:151)
        at org.zeromq.ZMsg.send(ZMsg.java:187)
        at org.zeromq.ZMsg.send(ZMsg.java:159)
        at org.zeromq.proto.ZPicture.sendBinaryPicture(ZPicture.java:168)
        at org.zeromq.ZMQ$Socket.sendBinaryPicture(ZMQ.java:3342)
		<<my code>>

@trevorbernard
Copy link
Member

@stealthrabbi Can you verify if this is still an issue with v0.5.3?

@stealthrabbi
Copy link
Author

stealthrabbi commented Jan 11, 2023

@trevorbernard I will try. The issue is that the exception sometimes takes many days to surface -- it's hard to pin down. Do you happen to have a list of things changed in 0.5.2 -> 0.5.3

@trevorbernard
Copy link
Member

https://github.com/zeromq/jeromq/blob/master/CHANGELOG.md

@stealthrabbi
Copy link
Author

stealthrabbi commented Jan 12, 2023

No the issue still exists in 0.5.3. Took about 24 hours to recreate. In my program, I've added an exception handler for this case, but I see now that the exception continues forever. I am guessing I need to create a new zmq socket. I also don't know if I can reuse the ZContext I created when my program starts, or if a new ZContext is needed.

@fbacchella
Copy link
Contributor

Just to be sure, the XPub socket is not shared between threads ?

@fbacchella
Copy link
Contributor

Can you try with this branch: https://github.com/fbacchella/jeromq/tree/issue938 ?

@elihusmails
Copy link

I am still seeing this issue with version 0.5.4.

@fbacchella
Copy link
Contributor

This branch was not merged as nobody provided any feebdback.

@elihusmails
Copy link

I added the changes to the Dist.java in my local 0.5.4 environment and recompiled/installed the change. While I'm not getting the stack trace, it appears that my app is silently failing now. I'm going to dig into this more.

@tommy2d
Copy link

tommy2d commented Apr 24, 2024

I'm also experiencing this issue and for me it seems fairly easily reproduceable:

at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) at java.base/java.util.Objects.checkIndex(Objects.java:361) at java.base/java.util.ArrayList.get(ArrayList.java:427) at zmq.socket.pubsub.Dist.distribute(Dist.java:161) at zmq.socket.pubsub.Dist.sendToMatching(Dist.java:137) at zmq.socket.pubsub.XPub.xsend(XPub.java:253) at zmq.SocketBase.send(SocketBase.java:829) at zmq.SocketBase.send(SocketBase.java:792) at org.zeromq.ZMQ$Socket.send(ZMQ.java:3445)

In my setup, a Java application creates a zeromq socket of tpye SocketType.PUB and connects to a XPUB/XPUB router. The connection is setup in the constructor of a class, and the oob exception is triggered periodically (but i can see it happening at least once a day in my current setup).

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

5 participants