You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2016/03/27 10:04:46 UTC

[Bug 59238] New: WebSocket gets messages after closing

https://bz.apache.org/bugzilla/show_bug.cgi?id=59238

            Bug ID: 59238
           Summary: WebSocket gets messages after closing
           Product: Tomcat 8
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: WebSocket
          Assignee: dev@tomcat.apache.org
          Reporter: pporvatov@gmail.com

Upgraded from apache-tomcat-8.0.22 to apache-tomcat-8.0.33. Now websockets get
messages (@OnMessage) even after the session is closed (by
javax.websocket.Session#close(javax.websocket.CloseReason) method).

The following events occurred:
1. invoke javax.websocket.Session#close(javax.websocket.CloseReason)

2. invoked
@OnClose
public void onClose(Session session, CloseReason closeReason) {

3. after getting messages invoked
@OnMessage
public void onMessage(Session session, ByteBuffer byteBuffer) {

I'm expecting that the close method close the session and I shouldn't get
messages anymore

OS: Ubuntu 64 bits

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59238] WebSocket gets messages after closing

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59238

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
I can see from code inspection how this could happen. I agree it looks odd on
the face of it. I need to look carefully at the spec.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59238] WebSocket gets messages after closing

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59238

--- Comment #4 from Pavel <pp...@gmail.com> ---
Thanks for the response. I didn't find any comments about described situation
in WebSocket spec, so the implementation can be selected by developers.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59238] WebSocket gets messages after closing

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59238

Violeta Georgieva <vi...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59238] WebSocket gets messages after closing

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59238

--- Comment #1 from Violeta Georgieva <vi...@apache.org> ---
Hi,

Is it possible to provide some sample application that shows the issue?

Thanks,
Violeta

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59238] WebSocket gets messages after closing

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59238

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
Bizarre as it may seem, Tomcat's behaviour is consistent with the Java
WebSocket specification.

2.1.5 requires that onClose() is invoked as a result of calling
session.close(). Before onClose() is invoked, the WebSocket close message is
sent to the peer. However, it is not a requirement to wait for the peer to
respond with a close message before invoking onClose().

The following sequence of events is therefore possible.
App calls session.onClose()
Close msg sent to peer
App sees onClose() invoked
Peer sends normal msg*
Peer receives close msg
Peer sends on close msg
App sees onMessage for msg*

There looks to be a case for separate local and remote onClose events. If you
want to pursue that, you should open an issue against the WebSocket spec:
https://java.net/jira/browse/WEBSOCKET_SPEC

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org