https://kotlinlang.org logo
#ktor
Title
# ktor
i

Ian

07/05/2018, 2:25 AM
Does anyone know why a .send() would block indefinitely on the outbound channel of a WebSocket connection? I’m not seeing anything to indicate that the websocket has closed.
d

Deactivated User

07/05/2018, 7:20 AM
It shouldn’t happen as far as I know. Can you provide more information to reproduce it? A sample code and steps for getting this behavior?
i

Ian

07/05/2018, 1:53 PM
May be tricky but I can try. Does the fact that calling offer() returns true a bunch of times, but then returns false with isFull returning true only after offer() has been called and returning false?
d

Deactivated User

07/05/2018, 1:54 PM
why do you need offer?
i

Ian

07/05/2018, 1:55 PM
I just tried it as an experiment because send() was blocking.
Also, a correction, it looks like isFull() is true before offer is called - so it just looks like the outbound channel is filling up to its buffer size, but it looks like it’s not being emptied by anything.
d

Deactivated User

07/05/2018, 1:57 PM
maybe the part that is consuming it, is broken
if you can reproduce it consistently with a simple snippet, that would help a lot
i

Ian

07/05/2018, 2:04 PM
I can try that but it may be tricky as this is currently happening in the middle of a large codebase. Looking in my debugger the outgoingToBeProcessed ArrayChannel is at capacity, 8, so it does look like whatever is pulling messages from that and sending them may have stopped, but I don’t see any exceptions
d

Deactivated User

07/05/2018, 2:07 PM
let me check the code handling websockets to see if it is swallowing exceptions
as far as I understand, on exception, the socket is closed
so might be a bug
^^ @e5l
i

Ian

07/05/2018, 2:17 PM
Hmm, I don’t see why it would silently swallow an exception
d

Deactivated User

07/05/2018, 2:18 PM
no, it doesn’t seems the case, but still something strange is happening, right?
i

Ian

07/05/2018, 2:19 PM
Yeah, I can confirm that the message prior to isFull being true was sent and received, so it appears like it was transmitted without being removed from the outgoing queue
d

Deactivated User

07/05/2018, 2:38 PM
I would fill an issue here: https://github.com/ktorio/ktor/issues With all the information you have, and if you manage to consistently or almost consistently reproduce it with a short isolated sample, would be super.
👀 1
e

e5l

07/05/2018, 2:38 PM
I’m not seeing anything to indicate that the websocket has closed.
It look's like a bug.
i

Ian

07/05/2018, 2:57 PM
@e5l Any tips on how to track it down? I’m hoping to avoid trying to whittle it down to a simple test case as that could require quite a bit of scaffolding. Definitely looks like messages are being sent over the websocket without being removed from the outgoing message queue - which then fills up
…checking to see whether it happens after the same number of messages are sent
no, it occurs after a variable number of messages, typically around 20 (so some are being removed from the outbound buffer, just not all)
FYI - issue created here. I need to focus on something else today but I can try to create a simple repeatable use-case. If this bug is affecting other people then it could be causing a lot of headaches. https://github.com/ktorio/ktor/issues/462
If any of you guys have any ideas for quick things I can check please let me know
2 Views