https://issues.apache.org/bugzilla/show_bug.cgi?id=54724

            Bug ID: 54724
           Summary: WsSession does not throw IllegalState exception if
                    closed when methods on it are called
           Product: Tomcat 8
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: nicho...@nicholaswilliams.net
    Classification: Unclassified

Spec JavaDoc says:

"Once the session is closed, it is no longer valid for use by applications.
Calling any of its methods once the session has been closed will result in an
IllegalStateException being thrown. Developers should retrieve any information
from the session during the Endpoint.onClose(Session, CloseReason) method."

Of course, the rules of Closeable also apply here, and calling
Session#close(...) more than once should have no effect subsequent times.

There are actually three problems here:

1) None of the methods throw IllegalStateException if the session is closed.
Instead, they return things (like the basic remote, for example), and some
methods in the endpoint implementation will not notice concurrent exceptions
from the socket and then block forever waiting four the Countdown to clear.

2) The Session#state is never actually changed to State.CLOSED unless
Session#onClose is called. However, Session#onClose is never actually called
that I can find (though I will look harder before I make changes).

3) Even in Session#onClose, the state is incorrectly changed to State.CLOSED
BEFORE Endpoint#onClose is called, when it should be changed AFTER.

I'm working on a patch for this.

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

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

Reply via email to