-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable autoPing in WS tests #3944
Conversation
Does this mean that ping frames are sent after the connection is properly closed by exchanging close frames? I'm wondering if this is some problem in our implementation, or is it just scoped to tests? |
I assumed they are sent right before the |
I investigated the subject, and:
ws.eitherClose(ws.receiveText()) and
I think this should be improved in sttp -> sending Ping/Pong should be silently skipped just like sending another Close when |
So I think that's a definitely good catch, but it would also be good to properly fix this, as by disabling auto-pings we won't catch such problems in the future. But I'm wondering what's the proper fix here ;) I think that first of all, after a channel is closed, we shouldn't send any more pings. Does this happen only in "our" Netty servers, or others as well? I think in Netty the problem might be fixed by removing the As for sttp, take a look at: softwaremill/sttp#2236 - is that what you meant? |
|
@kciesielski ah, we don't send any more pings because the "reactive stream" is complete, and it's being closed in Netty? Or is there another reason? I'm not quite able to pinpoint this in code. |
I did some extra digging and there may be indeed a problem with current Netty impl to guarantee no pings after Close. All other backends seem ok, because they send pings in the same stream. Even if merged from two parallel streams, that stream is ended with something like Line 35 in bc9b89f
pingTask = ctx.channel().eventLoop().scheduleAtFixedRate(sendPing,
pingInterval.toMillis, pingInterval.toMillis, TimeUnit.MILLISECONDS) and stop this in a handler: override def channelInactive(ctx: ChannelHandlerContext): Unit = {
super.channelInactive(ctx)
logger.debug(s"STOPPING WebSocket Ping scheduler for channel ${ctx.channel}")
if (pingTask != null) {
val _ = pingTask.cancel(false)
}
} I think it's technically possible that after a reactive streams sends |
Closing, because https://github.com/softwaremill/tapir/pull/3968/files pulls softwaremill/sttp-shared#425, which should resolve the issue on the client level. |
Sometimes WebSocket tests fail, because the default auto ping is sent to the client, which then tries to send back a pong, while the backend has already closed the connection.
This PR ensures that autoPing is enabled only in the test which actually tests pings.