-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
WebSocket - Handling sent 1009 close frame. #3666
Comments
The close frame sits after the current active message. But lets talk about other possible future options ... Close location in outgoing frame queue depends on remote received close frame type? Perhaps it would make more sense to allow the application to decide how to handle close? |
I wonder what would happen if your application had an |
Thanks for your response, joakime. Hmm. Yeah, it might be possible to set timeout to something short on It's still a bit wonky because the other side will never receive a close frame in response - but I guess it has to deal with similar situations anyway. Cheers |
Setting Is there a good way to catch when a Jetty is sending a close frame? My thinking is that the sender should also set its timeout to something short since it can't guarantee that it will get the close frame back in a timely fashion. As a (hopefully) interesting aside - it seems like Tomcat handles replying to a 1009 frame more gracefully (the close frame is responded to and large data frame write generates an exception). Don't know how comparable Tomcat is to Jetty but might be worth comparing notes? |
I don't understand how the close frame can be responded to? Once the 1GB message starts to be sent, then there is nothing that the sender can do to abort that prior to sending all the 1GB of payload... unless the 1GB is fragmented into many smaller frames, then the close can be sent after any of those frames.... but the other end has to keep consuming those frames else we will get blocked. We already have a mechanism for some frames (eg ping) to jump the queue of messages. Perhaps we need to handle 1009 in the same way - if we receive one, then we should queue a close reply at the start of the write queue and fail any frames in the queue behind it. We have to be careful about what close codes would have this behaviour as we don't want to break graceful close that would happen after all queued frames are sent. @lachlan-roberts your thoughts about jetty-10? |
@gregw Maybe if we receive a close frame which is an error status code, we could wrap this as an abnormal close frame. Then in the You could use the |
@lachlan-roberts I think a 1009 is an abnormal close, so if we already have logic to handle that, then yes - lets trigger it! Make it so! |
…queue Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
- code cleanups - made SHUTDOWN 1001 status an abnormal close status Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…queue Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
- code cleanups - made SHUTDOWN 1001 status an abnormal close status Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…Close Issue #3666 - error CloseFrames skip frames in the FrameFlusher queue
If Jetty "server" sends a large message (1GB in my tests) via WebSocket that causes the recipient to return a 1009 close frame - Jetty does not send the response close frame back. (As far as I can tell, it gets queued for sending behind the large message.) As a result the server's connection stays open until it times out naturally.
While this is technically to WebSocket speck - it's not ideal.
Am I missing something? Can this be addressed in a later version?
Thank you for your time :)
Using Jetty 9.4.18.v20190429.
The text was updated successfully, but these errors were encountered: