Websocket failures
See original GitHub issueKtor Version
0.9.3
Ktor Engine Used(client or server and name)
Server Netty
JVM Version, Operating System and Relevant Context
1.8.0_172
Feedback
I found various issues with Websockets, often happening after they run for a long time (months) They work properly but all of a sudden some exception happen and subsequent websocket clients are not able to connect again, websocket handlers are never called again.
Exception i observed throughout time are below:
This seems to be some sort of a protocol error or incomplete packet received. After this happened, it went into an inconsistent state.
2018-11-19 14:39:46.485|nettyWorkerPool-3-2 @coroutine#82620|Routing.kt:121:doResume() - [ERROR] Application: Websocket handler failed
kotlinx.coroutines.experimental.JobCancellationException: Child job was cancelled because of parent failure
at kotlinx.coroutines.experimental.JobSupport.cancelChildrenInternal(JobSupport.kt:587)
at kotlinx.coroutines.experimental.JobSupport.makeCompletingInternal(JobSupport.kt:572)
at kotlinx.coroutines.experimental.JobSupport.makeCompleting$kotlinx_coroutines_core(JobSupport.kt:525)
at kotlinx.coroutines.experimental.JobSupport.makeCompletingOnCancel(JobSupport.kt:519)
at kotlinx.coroutines.experimental.JobSupport.cancel(JobSupport.kt:463)
at kotlinx.coroutines.experimental.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:45)
at kotlinx.coroutines.experimental.StandaloneCoroutine.onFinishingInternal$kotlinx_coroutines_core(Builders.common.kt:174)
at kotlinx.coroutines.experimental.JobSupport.makeCompletingInternal(JobSupport.kt:577)
at kotlinx.coroutines.experimental.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:539)
at kotlinx.coroutines.experimental.AbstractCoroutine.resumeWithException(AbstractCoroutine.kt:122)
at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resumeWithException(CoroutineImpl.kt:47)
at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:41)
at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:41)
at kotlinx.coroutines.experimental.DispatchedTask$DefaultImpls.run(Dispatched.kt:162)
at kotlinx.coroutines.experimental.io.internal.MutableDelegateContinuation.run(MutableDelegateContinuation.kt:14)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Unsupported opcode b
at io.ktor.http.cio.websocket.FrameParser.getFrameType(FrameParser.kt:26)
at io.ktor.http.cio.websocket.FrameParser.parseHeader1(FrameParser.kt:69)
at io.ktor.http.cio.websocket.FrameParser.handleStep(FrameParser.kt:56)
at io.ktor.http.cio.websocket.FrameParser.frame(FrameParser.kt:52)
at io.ktor.http.cio.websocket.WebSocketReader.parseLoop(WebSocketReader.kt:72)
at io.ktor.http.cio.websocket.WebSocketReader.readLoop(WebSocketReader.kt:63)
at io.ktor.http.cio.websocket.WebSocketReader$readLoop$1.doResume(WebSocketReader.kt)
at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:42)
... 9 common frames omitted
This one as well, how is possible to send the same response over a websocket? It’s not quite clear.
2018-11-21 07:59:43.079|nettyWorkerPool-3-2 @coroutine#182725|Routing.kt:121:doResume() - [ERROR] Application: Websocket handler failed
io.ktor.server.engine.BaseApplicationResponse$ResponseAlreadySentException: Response has already been sent
at io.ktor.server.engine.BaseApplicationResponse$$special$$inlined$apply$lambda$1.doResume(BaseApplicationResponse.kt:32)
at io.ktor.server.engine.BaseApplicationResponse$$special$$inlined$apply$lambda$1.invoke(BaseApplicationResponse.kt)
at io.ktor.server.engine.BaseApplicationResponse$$special$$inlined$apply$lambda$1.invoke(BaseApplicationResponse.kt:16)
at io.ktor.pipeline.PipelineContext.proceed(PipelineContext.kt:49)
at io.ktor.pipeline.PipelineContext.proceedWith(PipelineContext.kt:35)
at io.ktor.server.engine.DefaultTransformKt$installDefaultTransformations$1.doResume(DefaultTransform.kt:22)
at io.ktor.server.engine.DefaultTransformKt$installDefaultTransformations$1.invoke(DefaultTransform.kt)
at io.ktor.server.engine.DefaultTransformKt$installDefaultTransformations$1.invoke(DefaultTransform.kt)
at io.ktor.pipeline.PipelineContext.proceed(PipelineContext.kt:49)
at io.ktor.pipeline.Pipeline.execute(Pipeline.kt:22)
at routes.AdapterKt$handleAfClients$1.doResume(Adapter.kt:143)
at routes.AdapterKt$handleAfClients$1.invoke(Adapter.kt)
at routes.AdapterKt$handleAfClients$1.invoke(Adapter.kt)
at io.ktor.websocket.RoutingKt$proceedWebSocket$2.doResume(Routing.kt:119)
at io.ktor.websocket.RoutingKt$proceedWebSocket$2.invoke(Routing.kt)
at io.ktor.websocket.RoutingKt$proceedWebSocket$2.invoke(Routing.kt)
at io.ktor.http.cio.websocket.DefaultWebSocketSessionImplKt.run(DefaultWebSocketSessionImpl.kt:165)
at io.ktor.websocket.RoutingKt.proceedWebSocket(Routing.kt:117)
at io.ktor.websocket.RoutingKt$webSocket$2.doResume(Routing.kt:92)
at io.ktor.websocket.RoutingKt$webSocket$2.invoke(Routing.kt)
at io.ktor.websocket.RoutingKt$webSocket$2.invoke(Routing.kt)
at io.ktor.websocket.RoutingKt$webSocketRaw$2$1$1$1$1.doResume(Routing.kt:52)
at io.ktor.websocket.RoutingKt$webSocketRaw$2$1$1$1$1.invoke(Routing.kt)
at io.ktor.websocket.RoutingKt$webSocketRaw$2$1$1$1$1.invoke(Routing.kt)
at io.ktor.http.cio.websocket.RawWebSocketKt.start(RawWebSocket.kt:49)
at io.ktor.websocket.WebSocketUpgrade$upgrade$2.doResume(WebSocketUpgrade.kt:54)
at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:42)
at kotlinx.coroutines.experimental.DispatchedTask$DefaultImpls.run(Dispatched.kt:162)
at kotlinx.coroutines.experimental.DispatchedContinuation.run(Dispatched.kt:26)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Explanation of error "WebSocket connection failure ... - Neo4j
WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver....
Read more >WebSocket connection failed. Error in browser console, since ...
Starting from version 8.0.4, a lot of this messages: WebSocket connection to 'ws://ip_host:port/api/live/ws' failed: centrifuge.js:544 ...
Read more >Websocket connections started failing after 29.09.2022. azure ...
Application is working fine locally, websocket connections works fine locally, and we didn't publish any new version to azure app service. asp.
Read more >WebSocket connection failed: Error during ... - Stack Overflow
I am trying to integrate Socket.io with Angular and I'm having difficulties making a connection from the client-side to the server. I've looked ......
Read more >Random websocket connection failing : r/learnprogramming
But sometimes like today I can't connect. Error: socket.io.min.js:8 WebSocket connection to 'wss://eu.example.com/...' failed: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Can’t reproduce in 1.4.1