Uh oh!
There was an error while loading. Please reload this page.
Restore Netty's channel-option failure semantics in ChannelManager - #2246
Closed
hyperxpro wants to merge 1 commit into
Closed
Restore Netty's channel-option failure semantics in ChannelManager#2246hyperxpro wants to merge 1 commit into
hyperxpro wants to merge 1 commit into
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Follow-up to #2219. That PR stopped setting channel options on the shared
Bootstrapand instead applies them per-channel from AHC's channel initializervia
Channel.config().setOption(...)inChannelManager.applyChannelOptions, toavoid Netty's per-connect
synchronized (options)copy inAbstractBootstrap.newOptionsArray()(issue #2218).The new
applyChannelOptionscalledsetOptiondirectly, which silently droppedthe error-handling that Netty's
AbstractBootstrap#setChannelOptionprovides.Compared to the previous
Bootstrap#optionpath this changed behaviour on theerror path only:
setOptionreturnsfalse): previously logged"Unknown channel option ..."; now completely silent — a mistyped entry inconfig.getChannelOptions()produces no warning.setOptionthrows (bad value / unsupported on socket): previously logged"Failed to set channel option ..."and, withCLOSE_ON_SET_OPTION_FAILUREdefaulting to
true, failed the connect with the real cause. Now the throwablepropagates out of
initChannel, whereChannelInitializerlogs a generic"Failed to initialize a channel"and closes it — so the connect fails with amasked cause and no option-specific diagnostic.
Fix
Mirror Netty's
AbstractBootstrap#setChannelOptioninapplyChannelOptions:setOptionreturnedfalse);close-on-failure semantics so a channel never connects with a half-applied
configuration.
Happy-path behaviour is unchanged. Only user-supplied
config.getChannelOptions()can hit these branches; the built-in defaults are all guarded to valid ranges.
Compiles clean on JDK 11 (
./mvnw -pl client -am compile).