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 2015/12/01 20:31:25 UTC

[Bug 57489] java.util.concurrent.ExecutionException: java.io.IOException: Key must be cancelled

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

Barry Coughlan <b....@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
             Status|RESOLVED                    |REOPENED

--- Comment #14 from Barry Coughlan <b....@gmail.com> ---
I can reproduce this on 8.0.29. I will create a proper test case that doesn't
need breakpoints during the week.

Reproduced with the following:

    @OnMessage
    public void onMessage(Session session, ModelObject msg) {
        try {
            session.getBasicRemote().sendText("Test"); // <-- Breakpoint here
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
1. Open websocket connection to the server
2. Send message from client to server, hits the breakpoint
3. Close the connection
4. Continue from the @OnMessage breakpoint

The following happens:

- Step 4 throws an exception as expected (java.io.IOException: An established
connection was aborted by the software in your host machine) (we catch and log
this exception)


- @OnError is called with a java.nio.channels.ClosedChannelException:
java.nio.channels.ClosedChannelException
    at sun.nio.ch.SocketChannelImpl.ensureReadOpen(SocketChannelImpl.java:256)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:299)
    at org.apache.tomcat.util.net.NioChannel.read(NioChannel.java:137)
    at
org.apache.coyote.http11.upgrade.NioServletInputStream.fillReadBuffer(NioServletInputStream.java:136)
    at
org.apache.coyote.http11.upgrade.NioServletInputStream.doIsReady(NioServletInputStream.java:49)
    at
org.apache.coyote.http11.upgrade.AbstractServletInputStream.isReady(AbstractServletInputStream.java:66)
    at
org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:49)
    at
org.apache.tomcat.websocket.server.WsHttpUpgradeHandler$WsReadListener.onDataAvailable(WsHttpUpgradeHandler.java:183)
    at
org.apache.coyote.http11.upgrade.AbstractServletInputStream.onDataAvailable(AbstractServletInputStream.java:198)
    at
org.apache.coyote.http11.upgrade.AbstractProcessor.upgradeDispatch(AbstractProcessor.java:96)
    at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:669)
    at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
    at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)


- Further attempts to send data on this session results in the "Key must be
cancelled" exception:
java.io.IOException: java.util.concurrent.ExecutionException:
java.io.IOException: Key must be cancelled
    at
org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:282)
    at
org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendPing(WsRemoteEndpointImplBase.java:174)
    at
org.apache.tomcat.websocket.WsRemoteEndpointBase.sendPing(WsRemoteEndpointBase.java:55)
    at com.myapp.WsOutbound.sendPing(WsOutbound.java:295)
        .....

The @OnClose method is never called.

-- 
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