Skip to content

Mirror Netty option-failure semantics in applyChannelOptions - #2247

Merged
hyperxpro merged 1 commit into
mainfrom
harden-channel-option-failure-handling
Jul 18, 2026
Merged

Mirror Netty option-failure semantics in applyChannelOptions#2247
hyperxpro merged 1 commit into
mainfrom
harden-channel-option-failure-handling

Conversation

@hyperxpro

Copy link
Copy Markdown
Member

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.

@hyperxpro
hyperxpro merged commit 5c01481 into mainJul 18, 2026
33 checks passed
@hyperxpro
hyperxpro deleted the harden-channel-option-failure-handling branch July 18, 2026 10:45
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@hyperxpro