[TYRUS-105] A @WebSocket Message with arguments (String, boolean) does not return any value Created: 22/Feb/13  Updated: 23/Feb/13  Resolved: 23/Feb/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: 1.0-b11
Fix Version/s: 1.0-b12

Type: Bug Priority: Critical
Reporter: jan.supol Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

WebSocketMessage javadoc says:

The allowed parameters are:
String and boolean pair to receive the message in parts
and an optional Session parameter.

the following method:

Unable to find source-code formatter for language: javadoc. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
@WebSocketMessage
public String partial(String msg, boolean finito) {
	return msg + "(" + finito + ")";
}

does not return any value, although javadoc permits it.



 Comments   
Comment by Pavel Bucek [ 23/Feb/13 ]

fixed in the trunk





[TYRUS-101] CloseReason not propagated to server side (when close() initiated from client) Created: 20/Feb/13  Updated: 21/Feb/13  Resolved: 21/Feb/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: 1.0-b11
Fix Version/s: 1.0-b12

Type: Bug Priority: Major
Reporter: Pavel Bucek Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified





[TYRUS-98] Return messages are dropped if websocket.send is called multiple times Created: 18/Feb/13  Updated: 19/Feb/13  Resolved: 19/Feb/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0-b12

Type: Bug Priority: Major
Reporter: arungupta Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Attached is a simple test case where 5 WebSocket connections are sent to an annotated endpoint and onMessage is called only twice and once in some cases.

This is also reported at:

https://blogs.oracle.com/arungupta/entry/collaborative_whiteboard_using_websocket_in#comment-1361007806787



 Comments   
Comment by arungupta [ 18/Feb/13 ]

Seems like I cannot attach the test case, its available at: https://blogs.oracle.com/arungupta/resource/tyrus-98-scalability.zip

Comment by Pavel Bucek [ 18/Feb/13 ]

Hi Arun,

can you please retest with latest trunk? I've just fixed major issue related to servlet integration.

we still do have some performance related issues, but I think your usecase should be already fixed.

thanks,
Pavel

Comment by Pavel Bucek [ 19/Feb/13 ]

fixed in the trunk (confirmed in email)

feel free to reopen if you find additional related issue(s).





[TYRUS-97] Method annotated with @WebSocketMessage with return type Float (generally primitive wrapper) is not deployed Created: 16/Feb/13  Updated: 18/Feb/13  Resolved: 18/Feb/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0-b12

Type: Bug Priority: Major
Reporter: stepan.kopriva Assignee: stepan.kopriva
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified





[TYRUS-95] Default port not parsed correctly when connecting to a server Created: 15/Feb/13  Updated: 15/Feb/13  Resolved: 15/Feb/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0-b12

Type: Bug Priority: Major
Reporter: arungupta Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Connecting to a remote WebSocket endpoint as:

WebSocketContainer container = ContainerProvider.getWebSocketContainer();
String uri = "ws://echo.websocket.org";
container.connectToServer(MyClient.class, URI.create(uri));

throws the following exception:

SEVERE: java.lang.IllegalArgumentException: port out of range:-1
at java.net.InetSocketAddress.<init>(InetSocketAddress.java:136)
at org.glassfish.tyrus.container.grizzly.GrizzlyClientSocket.connect(GrizzlyClientSocket.java:155)
at org.glassfish.tyrus.container.grizzly.GrizzlyEngine.openClientSocket(GrizzlyEngine.java:113)
at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:207)
at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:152)
at org.sample.client.TestRemoteClient.processRequest(TestRemoteClient.java:88)

Changing the URI to;

ws://echo.websocket.org:80/

fixed the error.



 Comments   
Comment by jitu [ 15/Feb/13 ]

Fixing in revision 357.





[TYRUS-93] ClientEndpoint session.getRequestURI()==null Created: 13/Feb/13  Updated: 14/Feb/13  Resolved: 14/Feb/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: 1.0-b12
Fix Version/s: 1.0-b12

Type: Bug Priority: Major
Reporter: mikc22 Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

uname -a
Linux mikc 3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:25:57 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux



 Description   

The following code will raise NPE on line where we want to obtain the session:

logger.log(Level.INFO, "Client connecting:{0}", s.getRequestURI().toString());

public class ProgrammaticClient extends Endpoint {
    private static final Logger logger = Logger.getLogger(HandShake.class.getCanonicalName());

    @Override
    public void onOpen(Session s, EndpointConfiguration ec) {
        logger.log(Level.INFO, "Client connecting:{0}", s.getRequestURI().toString());
        final RemoteEndpoint remote = s.getRemote();
        s.addMessageHandler(
                new MessageHandler.Basic<String>() {
                    @Override
                    public void onMessage(String recv) {
                        try {
                            //FIXME TC: s.close(new CloseReason(CloseReason.CloseCodes.TRY_AGAIN_LATER, recv));
                            remote.sendString(messageHandler(recv));
                        } catch (IOException ex) {
                            logger.log(Level.SEVERE, null, ex);
                        }
                    }
                });
        try {
            remote.sendString("client:open");
        } catch (IOException ex) {
            logger.log(Level.SEVERE, null, ex);
        }
    }

    public String messageHandler(String message) {
        logger.log(Level.INFO, "client message={0}", message);
        if(message.equals("client:open")) {
            
        }
        return message;
    }
}


 Comments   
Comment by Pavel Bucek [ 14/Feb/13 ]

fixed in the trunk





[TYRUS-92] auction doesn't alwyas start in auction sample shipped with Tyrus sources Created: 13/Feb/13  Updated: 26/Feb/13  Resolved: 26/Feb/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: 1.0-b11
Fix Version/s: 1.0-b12

Type: Bug Priority: Major
Reporter: mikc22 Assignee: stepan.kopriva
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux mikc 3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:25:57 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Firefox 14.0.1



 Description   

When deployed the Auction sample shipped with Tyrus sources I encountered the auction sometimes gets stuck on auction start when 30secs are left.

Steps to reproduce:

1. $AS_HOME/bin/asadmin start-domain
2. $AS_HOME/bin/asadmin deploy tyrus-sample-auction-1.0-SNAPSHOT.war
3. firefox http://localhost:8080/sample-auction/
4. Register, user1
5. Choose e.g. Swatch auction, wait till the auction starts
6. At 30secs it gets stuck
7. Reload the page, it won't help, sometime it helps to redeploy the auction sample



 Comments   
Comment by stepan.kopriva [ 26/Feb/13 ]

Auction sample changed so that the auction starts once the first client connects.





[TYRUS-91] connectToServer creates 2 SessionImpl instances Created: 13/Feb/13  Updated: 14/Feb/13  Resolved: 14/Feb/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: 1.0-b10
Fix Version/s: 1.0-b12

Type: Bug Priority: Major
Reporter: johanvos Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I had an issue with some simple clientcode:

container = ContainerProvider.getClientContainer();
Session session = container.connectToServer(MyEndpoint.class, null, new
URI(server));
session.addMessageHandler(myHandler);

The onMessage call on myHandler never got called.

I debugged this, and it turned out that there were 2 Session objects:
the one returned by Container.connectToServer, and a second one that
was created during handshake. Since I didn't add a handler to the
second one, my callback method never got called.
I could easily fix this by having the handler added in the onOpen
method on the Endpoint in MyEndpoint.class:
@Override
public void onOpen(Session session, EndpointConfiguration config) {
LOGGER.info("RedFXWebSocketEndpoint is opened, session
= "+session);
this.session = session;
session.addMessageHandler(this);
}

The Session object that is passed into this onOpen method is the second
SessionImpl.

I wonder however, if it is intentional that a second SessionImpl is
created?
For debugging info, I dumped the stacktrace for the 2 calls to the
SessionImpl constructor:
at java.lang.Thread.dumpStack(Thread.java:1342)
at org.glassfish.tyrus.SessionImpl.<init>(SessionImpl.java:115)
at
org.glassfish.tyrus.EndpointWrapper.createSessionForRemoteEndpoint(Endp
ointWrapper.java:305)
at
org.glassfish.tyrus.container.grizzly.GrizzlyClientSocket.addEndpoint(G
rizzlyClientSocket.java:244)
at
org.glassfish.tyrus.container.grizzly.GrizzlyEngine.openClientSocket(Gr
izzlyEngine.java:112)
at
org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.
java:198)
at
org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.
java:140)
at
org.redfx.client.websocket.WebSocketCommunicator.initialize(WebSocketCo
mmunicator.java:79)
...

And
at java.lang.Thread.dumpStack(Thread.java:1342)
at org.glassfish.tyrus.SessionImpl.<init>(SessionImpl.java:115)
at
org.glassfish.tyrus.EndpointWrapper.onConnect(EndpointWrapper.java:317)
at
org.glassfish.tyrus.container.grizzly.GrizzlyClientSocket.onConnect(Gri
zzlyClientSocket.java:336)
at
org.glassfish.tyrus.container.grizzly.WebSocketFilter.handleClientHandS
hake(WebSocketFilter.java:317)
at
org.glassfish.tyrus.container.grizzly.WebSocketFilter.handleHandshake(W
ebSocketFilter.java:308)
at
org.glassfish.tyrus.container.grizzly.WebSocketFilter.handleRead(WebSoc
ketFilter.java:230)
at
org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorRe
solver.java:119)
at
org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(Defa
ultFilterChain.java:273)
at
org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(D
efaultFilterChain.java:200)
at
org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFil
terChain.java:134)
at
org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFil
terChain.java:112)
at
org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:
77)
at
org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOT
ransport.java:818)
at
org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(Abstrac
tIOStrategy.java:112)
at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThre
adIOStrategy.java:115)
at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(Work
erThreadIOStrategy.java:55)
at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRun
nable.run(WorkerThreadIOStrategy.java:135)
at
org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(Abstr
actThreadPool.java:562)
at
org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(Abstract
ThreadPool.java:542)
at java.lang.Thread.run(Thread.java:722)



 Comments   
Comment by johanvos [ 13/Feb/13 ]

The following patch on RemoteEndpoint fixed my problem – but I didn't look at the internals of SPIRemoteEndpoint, so this may introduce other issues, although all tests still run fine:

  1. This patch file was generated by NetBeans IDE
  2. It uses platform neutral UTF-8 encoding and \n newlines.
      • Base (BASE)
        +++ Locally Modified (Based On LOCAL)
        @@ -302,8 +302,10 @@
        @Override
        public Session createSessionForRemoteEndpoint(SPIRemoteEndpoint re, String subprotocol, List<Extension> extensions) { - return new SessionImpl(container, re, this, subprotocol, extensions, isSecure, + SessionImpl answer = new SessionImpl(container, re, this, subprotocol, extensions, isSecure, uri == null ? null : URI.create(uri), queryString, templateValues); + remoteEndpointToSession.put(re, answer); + return answer; }

@Override
@@ -314,8 +316,11 @@
@Override
public void onConnect(SPIRemoteEndpoint gs, String subprotocol, List<Extension> extensions) {
// create a new session

  • SessionImpl session = new SessionImpl(container, gs, this, subprotocol, extensions, isSecure,
    + SessionImpl session = remoteEndpointToSession.get(gs);
    + if (session == null) { + session = new SessionImpl(container, gs, this, subprotocol, extensions, isSecure, uri == null ? null : URI.create(uri), queryString, templateValues); + }

    remoteEndpointToSession.put(gs, session);
    endpoint.onOpen(session, configuration);
    }

Comment by Pavel Bucek [ 13/Feb/13 ]

well, i have it fixed already in my local workspace and I took similar approach .. nevertheless, having you posted this here makes it actually more difficult I cannot accept any contribution without OCA - http://www.oracle.com/technetwork/community/oca-486395.html. Have you signed that? (Unable to find your name there).

Comment by Pavel Bucek [ 14/Feb/13 ]

fixed in the trunk, thanks!





[TYRUS-89] Implement the Encodeers/Decoders lifecycle as a new instance per connection (spec API 12) Created: 12/Feb/13  Updated: 21/Feb/13  Resolved: 21/Feb/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0-b12

Type: Bug Priority: Major
Reporter: stepan.kopriva Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified





[TYRUS-73] Session object coming as the parameter in @WebSocketClose annotated method is null Created: 26/Jan/13  Updated: 22/Feb/13  Resolved: 22/Feb/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0-b12

Type: Bug Priority: Major
Reporter: neilghosh Assignee: Pavel Bucek
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

glassfish 4 build 70



 Description   

I realized that the session object in the following method is coming
out to be null

@WebSocketClose
public void onClose(Session peer)

{ peers.remove(peer) }

Hence the session could not be removed from the list of connected
users.

This method is when I refresh/close the browser or I call websocket.close(); from the client JavaScript.



 Comments   
Comment by Pavel Bucek [ 21/Feb/13 ]

cannot reproduce with tyrus trunk.

can you please post complete reproducible testcase?

Thanks!

Comment by Pavel Bucek [ 22/Feb/13 ]

seems like this issue is already fixed; confirmed with neilghosh.

feel free to comment/reopen with reproducible testcase.





[TYRUS-51] Encoding binary return types is throwing EncodeException Created: 10/Nov/12  Updated: 20/Feb/13  Resolved: 20/Feb/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0-b12, 1.0

Type: Bug Priority: Major
Reporter: arungupta Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I have an annotation-driven endpoint with the following method:

    @WebSocketMessage
    public ByteBuffer echoBinary(ByteBuffer data) {
        System.out.println("echoBinary: " + data);
        for (byte b : data.array()) {
            System.out.print(b);
        }
        return data;
    }

The JavaScript sends binary data as:

function echoBinary() {
                var buffer = new ArrayBuffer(myField2.value.length);
                var bytes = new Uint8Array(buffer);
                for (var i=0; i<bytes.length; i++) {
                    bytes[i] = i;
                }
                websocket.send(buffer);
                writeToScreen("SENT (binary): " + buffer.byteLength + " bytes");
            }

The inbound payload in the POJO method is decoded and displayed correctly. But sending a response back throws the following exception:

SEVERE: java.lang.RuntimeException: Error trying to send the response.
	at org.glassfish.tyrus.AnnotatedEndpoint$Binary$1.onMessage(AnnotatedEndpoint.java:364)
	at org.glassfish.tyrus.SessionImpl.notifyMessageHandlers(SessionImpl.java:315)
	at org.glassfish.tyrus.EndpointWrapper.onMessage(EndpointWrapper.java:312)
	at org.glassfish.tyrus.grizzly.GrizzlyEndpoint.onMessage(GrizzlyEndpoint.java:139)
	at org.glassfish.grizzly.websockets.DefaultWebSocket.onMessage(DefaultWebSocket.java:157)
	at org.glassfish.grizzly.websockets.frametypes.BinaryFrameType.respond(BinaryFrameType.java:52)
	at org.glassfish.grizzly.websockets.DataFrame.respond(DataFrame.java:104)
	at org.glassfish.grizzly.websockets.WebSocketFilter.handleRead(WebSocketFilter.java:221)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:781)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:578)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:558)
	at java.lang.Thread.run(Thread.java:722)
Caused by: javax.net.websocket.EncodeException: Unable to encode 
	at org.glassfish.tyrus.EndpointWrapper.doEncode(EndpointWrapper.java:266)
	at org.glassfish.tyrus.RemoteEndpointWrapper.sendPolymorphic(RemoteEndpointWrapper.java:173)
	at org.glassfish.tyrus.RemoteEndpointWrapper.sendObject(RemoteEndpointWrapper.java:114)
	at org.glassfish.tyrus.AnnotatedEndpoint$Binary$1.onMessage(AnnotatedEndpoint.java:362)
	... 21 more

If the POJO implementation is changed to:

    @WebSocketMessage
    public void echoBinary(ByteBuffer data, Session session) throws IOException {
        System.out.println("echoBinary: " + data);
        for (byte b : data.array()) {
            System.out.print(b);
        }
        session.getRemote().sendBytes(data);
    }

the a response is received on the client as a Blob.



 Comments   
Comment by Pavel Bucek [ 20/Feb/13 ]

cannot reproduce.

feel free to reopen with reproducible testcase.





Generated at Tue Jul 26 16:47:28 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.