Uh oh!
There was an error while loading. Please reload this page.
Mirror Netty option-failure semantics in applyChannelOptions - #2247
Merged
Conversation
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
After #2219, channel options are applied per-channel in ChannelManager.applyChannelOptions via Channel.config().setOption(...) instead of Bootstrap#option. The direct call dropped the error handling that Netty's AbstractBootstrap#setChannelOption provided: an unknown option key is now silently ignored (previously logged Unknown channel option), and an option whose setOption throws now propagates out of initChannel as a generic channel-init failure that closes the channel with a masked cause, instead of being logged with the offending option and value.
Modification
In applyChannelOptions, mirror Netty's AbstractBootstrap#setChannelOption: warn and skip when setOption returns false (unknown option), and warn (naming the option and value) then rethrow on failure, preserving Netty's close-on-failure semantics so a channel never connects with a partially-applied configuration.
Result
Channel-option error handling and diagnostics match the pre-#2219 Bootstrap behavior again. Happy-path behavior is unchanged, and only user-supplied config.getChannelOptions() can reach these branches since the built-in defaults are guarded to valid ranges.