Skip to content
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

Handle EOF in web socket by shutting down stage #2695

Merged
merged 1 commit into from Jul 5, 2019

Conversation

@rossabaker
Copy link
Member

@rossabaker rossabaker commented Jul 5, 2019

As described in #2651, we're getting a noisy EOF when shutting down web sockets under certain circumstances. Usually we call stageShutdown() when we receive this to do any cleanup, so added that as a special case. This may result in stageShutdown() being called multiple times, but that's normal.

This feels a tad sloppy, but not as sloppy as scary errors in user logs for situations that should be harmless.

@rossabaker rossabaker mentioned this pull request Jul 5, 2019
@rossabaker
Copy link
Member Author

@rossabaker rossabaker commented Jul 5, 2019

Even the "error closing websocket" name is misleading. When we get a ProtocolException decoding the incoming websocket, it gets logged there.

Loading

kubukoz
kubukoz approved these changes Jul 5, 2019
@rossabaker rossabaker merged commit 31ee3aa into http4s:series/0.20 Jul 5, 2019
1 check passed
Loading
@Dennis4b
Copy link

@Dennis4b Dennis4b commented Jul 21, 2019

This patch wraps stageShutdown in other IO:

128       case Left(EOF) =>                                                                                                    
129         IO(stageShutdown())

but stageShutdown itself looks like:

138   override protected def stageShutdown(): Unit = {                                                                         
139     F.toIO(deadSignal.set(true)).unsafeRunSync()                                                                           
140     super.stageShutdown()                                                                                                  
141   }

This nesting with unsafeRunSyncs increases the risk of deadlocks.

The following would IMHO be preferrable:

case Left(EOF) =>
    F.toIO(deadSignal.set(true)).map(_ => super.stageShutdown)

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants