users@tyrus.java.net

Re: Multiple Tyrus standalone clients with Undertow

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Mon, 16 Jun 2014 10:47:56 +0200

Hi Michał,

that is quite interesting.. unfortunately seems to be kind of difficult
setup to reproduce.

Are you sure that the clients are in the separate processes? (Does that
mean different JVM?) If that is true, then this is even more interesting.

Could you please share more details about your setup and testcase,
ideally as reproducible (test) case?

Another thought - do you have @OnError (or Endpoint.onError) methods
implemented in your client endpoint? Are they invoked?

Regards,
Pavel


On 16/06/14 09:25, Michał Ćmil wrote:
> Hello,
>
> I have a strange issue using the Tyrus standalone client (JDK and the
> standard one - I also tried the shared client option) and I wonder if
> I'm doing something wrong or its a bug.
>
> My setup consists of 2 Undertow server endpoints on WildFly and 2
> standalone Tyrus client endpoints. If I run two client instances
> (separate processes on the same machine), I get something similar to
> a "race condition". Only the first endpoint of the first client is
> able to RECEIVE messages, but every client can send them. I can also
> see, that the server endpoints are sending the messages to all
> clients. I checked the setup using tcpviewer and both instances are
> creating their connections.
>
> However If I send a message through the channel before launching
> another instance, then everything works. Additionally, everything
> works fine with different implementations (JS clients).
>
> I create my endpoint using the getWebSocketContainer method:
> Session s =
> ContainerProvider.getWebSocketContainer().connectToServer(new
> MultiUserEndpoint(selectionInfos),
> new URI("ws://192.168.55.168:8080/rest.research/multiuser
> <http://192.168.55.168:8080/rest.research/multiuser>"));
> UpdateEndpoint ue = new UpdateEndpoint(ops);
> Session us =
> ContainerProvider.getWebSocketContainer().connectToServer(ue, new URI(
> "ws://192.168.55.168:8080/rest.research/update
> <http://192.168.55.168:8080/rest.research/update>"));
>
> My dependency:
> <dependency>
> <groupId>org.glassfish.tyrus.bundles</groupId>
> <artifactId>tyrus-standalone-client-jdk</artifactId>
> <version>1.7</version>
> </dependency>
>
> I would be grateful for any advice on this issue.
>
> Best Regards,
> Michał