users@tyrus.java.net

Re: Multiple Tyrus standalone clients with Undertow

From: Michał Ćmil <cmilmichal_at_gmail.com>
Date: Mon, 16 Jun 2014 16:39:35 +0200

Hello Pavel,

I've created a minimal sample for the bug report:
https://java.net/jira/browse/TYRUS-333. It seems that two clients are not
the main cause of the problem. Simply creating two endpoints gets me into
trouble. Maybe I'm getting something wrong, but my sample is rather simple
and (whats the worst part) sometime it works (mainly when I remove the
delays from the sample). I checked it on JDK 7 - still the same issues.

Best Regards,
Michal


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

> On 16/06/14 11:09, Michał Ćmil wrote:
>
> 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.
>
>
> hmm.. have you tried different server? If your application is simple
> enough, you could try Standalone Grizzly server from Tyrus or Glassfish if
> it is more complex. (Please use last nightly build from
> http://dlc.sun.com.edgesuite.net/glassfish/4.0.1/nightly/latest-glassfish.zip)
>
>
>
> 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.
>
>
> yeah, but in that case, clients does not seem to be that relevant.. and
> they cannot really share anything among each other if there is separate JVM
> instance for each of them.. but if you are able to see messages on the
> wire.. well, I'm really interested in your test case.
>
>
>
> 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.
>
>
> that should not be a problem, but if possible, can you re-test with JDK 7
> (u60)?
>
>
>
> I'll try to create an isolated sample - should I post it to this group, or
> create an issue on the bug tracker?
>
>
> bugreport seems to be more appropriate (and we can continue the discussion
> here on the mailing list).
>
> Thanks again,
> Pavel
>
>
>
>
> 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ł
>>
>>
>>
>
>