Claus Ibsen created CAMEL-27919:
-----------------------------------

             Summary: camel-netty: option.* channel options dropped or fail, 
bootstrapConfiguration overrides URI options, UDP consumer closes its own 
channel
                 Key: CAMEL-27919
                 URL: https://issues.apache.org/jira/browse/CAMEL-27919
             Project: Camel
          Issue Type: Bug
          Components: camel-netty
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-netty for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31180).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. option.* channel options are dropped or fail the route
{{NettyServerBootstrapConfiguration.addAdditionalOptions}} / getOptionValue 
keep only about 20 known option names (matched with contains()); other names, 
such as option.child.keepAlive and option.RCVBUF_ALLOCATOR=#ref, are dropped 
without a message, and bean references never reach the "#" branches. 
{{SingleTCPNettyServerBootstrapFactory}} and 
{{SingleUDPNettyServerBootstrapFactory}} pass entry.getValue().toString() to 
Netty, which throws ClassCastException for non-String options, so the route 
fails to start. The TCP server sets all options with option() and never with 
childOption(), and {{ClientModeTCPNettyServerBootstrapFactory}} ignores them.
Proposed change: pass the typed value, map the child. prefix to childOption, 
and keep unknown names (WARN or reference lookup).

h4. 2. bootstrapConfiguration overrides the URI options
{{NettyComponent.createEndpoint}} applies the bootstrapConfiguration bean after 
parsing the URI, and getProperties also copies primitive fields that were never 
set, so netty:tcp://localhost:5123?bootstrapConfiguration=#b&tcpNoDelay=false 
ends with port=0 and tcpNoDelay=true. netty-http merges the bean before the URI.
Proposed change: merge before parseConfiguration, as netty-http does.

h4. 3. UDP consumer closes its own listening channel
{{ServerChannelHandler.sendResponse}} closes ctx.channel() when the reply body 
is null and disconnectOnNoReply is on (the default, with sync=true by default). 
For UDP this is the bound channel, so the consumer stops receiving. 
{{ServerResponseFutureListener}} does the same with disconnect=true or the 
CamelNettyCloseChannelWhenComplete header.
Proposed change: skip the close for UDP, as the exception path already does.

h4. 4. nativeTransport on macOS mixes KQueue and Epoll
{{NettyWorkerPoolBuilder}} prefers KQueue, but the UDP consumer and producer 
and the clientMode consumer always use the Epoll channel classes, so event loop 
group and channel do not match.
Proposed change: use the KQueue channel classes when KQueue is used.

h4. 5. doStop shuts down shared resources
{{NettyComponent.doStop}} shuts down a user-supplied executorService (and sets 
it to null) and the workerGroup of the component configuration even when it is 
shared. The executor group is created from the usingExecutorService of the 
component configuration, not of the endpoint.

h4. 6. Smaller issues
broadcast is labelled consumer, but the UDP producer sets SO_BROADCAST too. 
connectTimeout is labelled producer, but a clientMode consumer uses it; it is 
also set as a child option on the TCP server, where it does nothing. backlog is 
applied to the UDP bootstrap, where Netty warns "Unknown channel option". 
useByteBuf is labelled producer but also converts the consumer reply. 
networkInterface defaults to "lo", which does not exist on macOS. passphrase 
null on the path without sslContextParameters gives a NullPointerException 
instead of a clear error. The doc page section "Using Multiple Codecs" still 
uses Netty 3 terms.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to