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

NIO client: ClientBootstrap.channelInitializer can be called multiple times #438

Closed
weissi opened this issue Apr 17, 2019 · 3 comments
Closed

Comments

@weissi
Copy link
Contributor

weissi commented Apr 17, 2019

This is just something to watch out for. In NIO 1&2, the channelInitializer can be called multiple times because we do happy eyeballs with real channels. So you might see one being brought up for IPv4 and one for IPv6. NIO will close the losing one, so as you'd expect only one channel will survive (and be handed to you via connect's future) however there might be multiple channelInitializers run.

The code right in here assumes that this doesn't happen. So worst case (unlikely) is that the Channel that NIO decides to kill will complete the multiplexerPromise and then you're left in a bad spot: multiplexerPromise succeeded with the multiplexer from the closed Channel. Likely outcome for this situation would be random hangs. In this NIO issue I describe how to handle this situation and that we should in the future offer something easier than what you have to do today.

@MrMage
Copy link
Collaborator

MrMage commented Apr 17, 2019

The code right in here assumes that this doesn't happen. So worst case (unlikely) is that the Channel that NIO decides to kill will complete the multiplexerPromise and then you're left in a bad spot: multiplexerPromise succeeded with the multiplexer from the closed Channel.

Could that be what is actually happening in #430?

@glbrntt
Copy link
Collaborator

glbrntt commented Apr 17, 2019

Quite possibly; I came across this the other day but haven't pushed up the fix yet.

@MrMage
Copy link
Collaborator

MrMage commented May 6, 2019

Fixed by #439.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants