java.lang.IllegalStateException: The connection has been closed.

Java.net JIRA | rundgrent | 1 year ago
  1. 0

    I have a small image sending application that works ok with small files, but fails when working with bigger ones. Wondering if this is some kind of setting somewhere or what. I get almost same kind of error in both cases (running as standalone or deployed in Application server. The image is sent by a client (JavaFX) application and it is received on the server (and stored there as a file to verify that it is correct). Then the file is sent to all connected clients where it is displayed. Error I get with bigger files is as follows: {code}2015-12-01 15:35:15,694 [grizzly-nio-kernel(2) SelectorRunner] INFO com.volvo.adt.websocketserver.WebsocketEndPointImage.onClose() - Client disconnected ... removing from session TyrusSession{uri=/websocket/images, id='e9251ffa-8de2-4069-9db5-5b1797871146', endpointWrapper=TyrusEndpointWrapper{endpointClass=null, endpoint=org.glassfish.tyrus.core.AnnotatedEndpoint@764e76ff, contextPath='/websocket', endpointPath=/websocket/images, encoders=[CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpTextCoder, coder=org.glassfish.tyrus.core.coder.NoOpTextCoder@4225658e, type=class java.lang.String}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpByteBufferCoder, coder=org.glassfish.tyrus.core.coder.NoOpByteBufferCoder@27109b6f, type=class java.nio.ByteBuffer}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpByteArrayCoder, coder=org.glassfish.tyrus.core.coder.NoOpByteArrayCoder@66854a9f, type=class [B}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.ToStringEncoder, coder=org.glassfish.tyrus.core.coder.ToStringEncoder@63f9213e, type=class java.lang.Object}], decoders=[CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$BooleanDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$BooleanDecoder@a1931da, type=class java.lang.Boolean}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$ByteDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$ByteDecoder@29f10815, type=class java.lang.Byte}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$CharacterDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$CharacterDecoder@65ec7e06, type=class java.lang.Character}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$DoubleDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$DoubleDecoder@4fb65354, type=class java.lang.Double}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$FloatDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$FloatDecoder@c623c99, type=class java.lang.Float}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$IntegerDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$IntegerDecoder@2df23ca0, type=class java.lang.Integer}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$LongDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$LongDecoder@2be87b56, type=class java.lang.Long}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$ShortDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$ShortDecoder@56b9b18c, type=class java.lang.Short}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpTextCoder, coder=org.glassfish.tyrus.core.coder.NoOpTextCoder@4ba2d936, type=class java.lang.String}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpByteBufferCoder, coder=org.glassfish.tyrus.core.coder.NoOpByteBufferCoder@7789fbde, type=class java.nio.ByteBuffer}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpByteArrayCoder, coder=org.glassfish.tyrus.core.coder.NoOpByteArrayCoder@1f530cb2, type=class [B}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.ReaderDecoder, coder=org.glassfish.tyrus.core.coder.ReaderDecoder@47dfb05, type=class java.io.Reader}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.InputStreamDecoder, coder=org.glassfish.tyrus.core.coder.InputStreamDecoder@594be9d5, type=class java.io.InputStream}]}} dec 01, 2015 3:35:15 EM org.glassfish.tyrus.container.grizzly.client.GrizzlyWriter$WriterCondition$1 onError WARNING: Connection closed java.io.IOException: Connection closed at org.glassfish.grizzly.asyncqueue.TaskQueue.onClose(TaskQueue.java:317) at org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.onClose(AbstractNIOAsyncQueueWriter.java:501) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.closeConnection(TCPNIOTransport.java:412) at org.glassfish.grizzly.nio.NIOConnection.doClose(NIOConnection.java:604) at org.glassfish.grizzly.nio.NIOConnection$5.run(NIOConnection.java:570) at org.glassfish.grizzly.nio.DefaultSelectorHandler.execute(DefaultSelectorHandler.java:234) at org.glassfish.grizzly.nio.NIOConnection.terminate0(NIOConnection.java:564) at org.glassfish.grizzly.nio.transport.TCPNIOConnection.terminate0(TCPNIOConnection.java:291) at org.glassfish.grizzly.nio.transport.TCPNIOAsyncQueueWriter.write0(TCPNIOAsyncQueueWriter.java:136) at org.glassfish.grizzly.nio.transport.TCPNIOAsyncQueueWriter.write0(TCPNIOAsyncQueueWriter.java:106) at org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.processAsync(AbstractNIOAsyncQueueWriter.java:344) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:107) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.executeIoEvent(WorkerThreadIOStrategy.java:103) at org.glassfish.grizzly.strategies.AbstractIOStrategy.executeIoEvent(AbstractIOStrategy.java:89) at org.glassfish.grizzly.nio.SelectorRunner.iterateKeyEvents(SelectorRunner.java:414) at org.glassfish.grizzly.nio.SelectorRunner.iterateKeys(SelectorRunner.java:383) at org.glassfish.grizzly.nio.SelectorRunner.doSelect(SelectorRunner.java:347) at org.glassfish.grizzly.nio.SelectorRunner.run(SelectorRunner.java:278) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: An existing connection was forcibly closed by the remote host at sun.nio.ch.SocketDispatcher.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:51) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) at org.glassfish.grizzly.nio.transport.TCPNIOUtils.flushByteBuffer(TCPNIOUtils.java:149) at org.glassfish.grizzly.nio.transport.TCPNIOUtils.writeSimpleBuffer(TCPNIOUtils.java:133) at org.glassfish.grizzly.nio.transport.TCPNIOAsyncQueueWriter.write0(TCPNIOAsyncQueueWriter.java:126) ... 16 more{code} {code}2015-12-01 15:35:34,348 [Grizzly-worker(8)] FATAL com.volvo.adt.websocketserver.WebsocketEndPointImage.onError() - OnError: TyrusSession{uri=/websocket/images, id='e9251ffa-8de2-4069-9db5-5b1797871146', endpointWrapper=TyrusEndpointWrapper{endpointClass=null, endpoint=org.glassfish.tyrus.core.AnnotatedEndpoint@764e76ff, contextPath='/websocket', endpointPath=/websocket/images, encoders=[CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpTextCoder, coder=org.glassfish.tyrus.core.coder.NoOpTextCoder@4225658e, type=class java.lang.String}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpByteBufferCoder, coder=org.glassfish.tyrus.core.coder.NoOpByteBufferCoder@27109b6f, type=class java.nio.ByteBuffer}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpByteArrayCoder, coder=org.glassfish.tyrus.core.coder.NoOpByteArrayCoder@66854a9f, type=class [B}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.ToStringEncoder, coder=org.glassfish.tyrus.core.coder.ToStringEncoder@63f9213e, type=class java.lang.Object}], decoders=[CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$BooleanDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$BooleanDecoder@a1931da, type=class java.lang.Boolean}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$ByteDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$ByteDecoder@29f10815, type=class java.lang.Byte}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$CharacterDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$CharacterDecoder@65ec7e06, type=class java.lang.Character}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$DoubleDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$DoubleDecoder@4fb65354, type=class java.lang.Double}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$FloatDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$FloatDecoder@c623c99, type=class java.lang.Float}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$IntegerDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$IntegerDecoder@2df23ca0, type=class java.lang.Integer}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$LongDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$LongDecoder@2be87b56, type=class java.lang.Long}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.PrimitiveDecoders$ShortDecoder, coder=org.glassfish.tyrus.core.coder.PrimitiveDecoders$ShortDecoder@56b9b18c, type=class java.lang.Short}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpTextCoder, coder=org.glassfish.tyrus.core.coder.NoOpTextCoder@4ba2d936, type=class java.lang.String}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpByteBufferCoder, coder=org.glassfish.tyrus.core.coder.NoOpByteBufferCoder@7789fbde, type=class java.nio.ByteBuffer}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.NoOpByteArrayCoder, coder=org.glassfish.tyrus.core.coder.NoOpByteArrayCoder@1f530cb2, type=class [B}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.ReaderDecoder, coder=org.glassfish.tyrus.core.coder.ReaderDecoder@47dfb05, type=class java.io.Reader}, CoderWrapper{coderClass=class org.glassfish.tyrus.core.coder.InputStreamDecoder, coder=org.glassfish.tyrus.core.coder.InputStreamDecoder@594be9d5, type=class java.io.InputStream}]}} java.lang.IllegalStateException: The connection has been closed. at org.glassfish.tyrus.core.TyrusSession.checkConnectionState(TyrusSession.java:530) at org.glassfish.tyrus.core.TyrusSession.setState(TyrusSession.java:690) at org.glassfish.tyrus.core.TyrusEndpointWrapper.onPartialMessage(TyrusEndpointWrapper.java:1073) at org.glassfish.tyrus.core.TyrusWebSocket.onFragment(TyrusWebSocket.java:171) at org.glassfish.tyrus.core.frame.BinaryFrame.respond(BinaryFrame.java:91) at org.glassfish.tyrus.core.ProtocolHandler.process(ProtocolHandler.java:807) at org.glassfish.tyrus.core.TyrusWebSocketEngine$TyrusReadHandler.handle(TyrusWebSocketEngine.java:562) at org.glassfish.tyrus.container.grizzly.server.GrizzlyServerFilter$ProcessTask.execute(GrizzlyServerFilter.java:379) at org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:114) at org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:91) at org.glassfish.tyrus.container.grizzly.server.GrizzlyServerFilter.handleRead(GrizzlyServerFilter.java:215) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571) at java.lang.Thread.run(Thread.java:745){code}

    Java.net JIRA | 1 year ago | rundgrent
    java.lang.IllegalStateException: The connection has been closed.
  2. 0

    #14432 (Push with weblogic 12.1.2 and websockets) – Vaadin

    vaadin.com | 8 months ago
    java.lang.IllegalStateException: The connection has been closed.
  3. 0

    Java Spring Audio chat

    Stack Overflow | 1 year ago | Elbassel
    java.lang.IllegalStateException: Text message handler not found. Session: 'TyrusSession{uri=/WindTest/voiceChat/asd/username, id='6899d950-9e2e-4950-8bb8-03bd839253c0', endpointWrapper=TyrusEndpointWrapper{endpointClass=null, endpoint=org.glassfish.tyrus.core.AnnotatedEndpoint@5bb273b4, contextPath='/WindTest'}}'.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Work on simpleslackapi to survive Slack outages

    GitHub | 1 year ago | denis-yuen
    java.lang.IllegalStateException: The connection has been closed.
  6. 0

    Keep-alive mechanism fails when connection is closed (probably due to network error)

    GitHub | 2 years ago | nilsga
    java.lang.IllegalStateException: The connection has been closed.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      The connection has been closed.

      at org.glassfish.tyrus.core.TyrusSession.checkConnectionState()
    2. Tyrus Core
      TyrusWebSocketEngine$TyrusReadHandler.handle
      1. org.glassfish.tyrus.core.TyrusSession.checkConnectionState(TyrusSession.java:530)
      2. org.glassfish.tyrus.core.TyrusSession.setState(TyrusSession.java:690)
      3. org.glassfish.tyrus.core.TyrusEndpointWrapper.onPartialMessage(TyrusEndpointWrapper.java:1073)
      4. org.glassfish.tyrus.core.TyrusWebSocket.onFragment(TyrusWebSocket.java:171)
      5. org.glassfish.tyrus.core.frame.BinaryFrame.respond(BinaryFrame.java:91)
      6. org.glassfish.tyrus.core.ProtocolHandler.process(ProtocolHandler.java:807)
      7. org.glassfish.tyrus.core.TyrusWebSocketEngine$TyrusReadHandler.handle(TyrusWebSocketEngine.java:562)
      7 frames
    3. Tyrus Grizzly Server Container
      GrizzlyServerFilter$ProcessTask.execute
      1. org.glassfish.tyrus.container.grizzly.server.GrizzlyServerFilter$ProcessTask.execute(GrizzlyServerFilter.java:379)
      1 frame
    4. Tyrus Grizzly Client Container
      TaskProcessor.processTask
      1. org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:114)
      2. org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:91)
      2 frames
    5. Tyrus Grizzly Server Container
      GrizzlyServerFilter.handleRead
      1. org.glassfish.tyrus.container.grizzly.server.GrizzlyServerFilter.handleRead(GrizzlyServerFilter.java:215)
      1 frame
    6. Grizzly
      AbstractThreadPool$Worker.run
      1. org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      2. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
      3. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
      4. org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
      5. org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
      6. org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      7. org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
      8. org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      9. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      10. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      11. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      12. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
      13. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
      13 frames