You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When parallel subscribe in different threads two consumer on local idle nats, i received sometimes an IOException:Timeout after two seconds.
Expected behavior
No timeout
Server and client version
Server: 2.10.1
Client: jnats 2.16.14
Host environment
Xubuntu 22.04.3 6.2.0-33-generic x86_64
Steps to reproduce
After a few iteration with my testcode:
Iteration: 0
Stream [1] established.
Stream [0] established.
Iteration: 1
Stream [0] established.
Stream [1] established.
Iteration: 2
Stream [0] established.
Stream [1] established.
Iteration: 3
Stream [1] established.
Stream [0] not established.
java.io.IOException: Timeout or no response waiting for NATS JetStream server
at io.nats.client.impl.NatsJetStreamImpl.responseRequired(NatsJetStreamImpl.java:216)
at io.nats.client.impl.NatsJetStreamImpl.makeRequestResponseRequired(NatsJetStreamImpl.java:200)
at io.nats.client.impl.NatsJetStreamImpl._getStreamNames(NatsJetStreamImpl.java:151)
at io.nats.client.impl.NatsJetStreamImpl.lookupStreamBySubject(NatsJetStreamImpl.java:191)
at io.nats.client.impl.NatsJetStream.createSubscription(NatsJetStream.java:301)
at io.nats.client.impl.NatsJetStream.subscribe(NatsJetStream.java:563)
at NatsTimeoutOnParallelSubscribe.lambda$0(NatsTimeoutOnParallelSubscribe.java:54)
at java.base/java.lang.Thread.run(Thread.java:833)
Error on subscribe
Is this repeatable against a local, non-cluster server? This seems unusual, the subscribe request reply should take milliseconds. not accounting for things like network latency, server load.
Yes, this issue comes from my local (non-cluster) machine.
I think this is not a server side problem, but rather a multithreading problem on clientside. With the synchronize block the issue is gone.
I'm very concerned about putting a synchronize block around that code since it does not explain why there is a timeout, even if the problem appears to go away when you sync it. If there is an issue, I think there is another reason to be figured out. Will have to look into this.
Observed behavior
When parallel subscribe in different threads two consumer on local idle nats, i received sometimes an IOException:Timeout after two seconds.
Expected behavior
No timeout
Server and client version
Server: 2.10.1
Client: jnats 2.16.14
Host environment
Xubuntu 22.04.3 6.2.0-33-generic x86_64
Steps to reproduce
After a few iteration with my testcode:
After some debugging the problem is an timout in https://github.com/nats-io/nats.java/blob/2.16.14/src/main/java/io/nats/client/impl/NatsConnection.java#L1098
I think in the block https://github.com/nats-io/nats.java/blob/2.16.14/src/main/java/io/nats/client/impl/NatsConnection.java#L1161 seems to be exists an multithreading-problem
Pragmatic way: After synchronize the part, the timeout-xpt is gone:
Testcode:
The text was updated successfully, but these errors were encountered: