Using ktor websockets in browser. Noticed sometime...
# ktor
p
Using ktor websockets in browser. Noticed sometimes error in console. What can be the cause? How to dig?
Copy code
IllegalStateException: Already resumed, but proposed with update CompletedExceptionally[io.ktor.client.plugins.websocket.WebSocketException: {"target":{},"type":"error","isTrusted":true}]
a
Can you please share the complete stack trace?
p
It's the production build. No valuable info in it
Copy code
Uncaught IllegalStateException: Already resumed, but proposed with update CompletedExceptionally[io.ktor.client.plugins.websocket.WebSocketException: {"target":{},"type":"error","isTrusted":true}]
    createJsError <http://192.168.0.2:8080/app.wasm.js:2>
    764/</web.streams.__convertKotlinClosureToJsClosure_((Js)->Unit)/< <http://192.168.0.2:8080/app.wasm.js:2>
Caused by: null
app.wasm.js:2:375526
Its happens when while web page opened put laptop to hibernation and resume
a
Unfortunately, I cannot reproduce the exception, but it seems the exception is thrown here, which may happen if the
CompletableDeferred
was already completed within the onclose callback.
p
It seems like error event happens more then once? Is it possible to handle it (or suppress if not critical) on user side?
a
I've filed an issue KTOR-9361 to address this problem. Can you please try wrapping the websocket call in a try/catch block to catch the exception?
thank you color 1
p
Wrapping with try/catch didn't help. May be this event is triggering internally in other coroutine.
a
Then, unfortunately, the issue can be fixed only on our side.