users@tyrus.java.net

Re: Multiple Tyrus standalone clients with Undertow

From: Michał Ćmil <cmilmichal_at_gmail.com>
Date: Mon, 16 Jun 2014 11:09:32 +0200

Hello Pavel,

Thanks for taking your time on my problem. I'm starting a new instance of
the application from Eclipse, and its getting a separate PID. I have an
@OnError implemented - unfortunately it is not invoked. I tried to debug
some internal endpoint mechanisms on the client, but the data just doesn't
arrive on one of the instances. What is more, the server endpoint sees a
new connection from both clients, and sends the data to both of them. If I
start a new instance of a JS client in such "blocked" state, it wont work
either. If I run only JS instances - its all ok.

The most interesting things is I can make it work by starting the instances
sequentially - the only condition is that I send some data through the
channel before starting the second instance.

One more detail is that I use JDK 8 on Windows 7 64-bit. I tried using
localhost and my LAN endpoint (192.168... binding) - the outcome is the
same. I checked both processes using jvisualvm but nothing seemed out of
order.

I'll try to create an isolated sample - should I post it to this group, or
create an issue on the bug tracker?

Best Regards,
Michal


2014-06-16 10:47 GMT+02:00 Pavel Bucek <pavel.bucek_at_oracle.com>:

>
> 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"));
> UpdateEndpoint ue = new UpdateEndpoint(ops);
> Session us = ContainerProvider.getWebSocketContainer().connectToServer(ue,
> new URI(
> "ws://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ł
>
>
>