[ https://issues.apache.org/jira/browse/CAMEL-5225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13263813#comment-13263813 ]
edge wang commented on CAMEL-5225: ---------------------------------- Here are some references: 1.showing that unsharable decoders should not be shared among channels(pipelines) http://stackoverflow.com/questions/9254800/is-framedecoder-not-safe-in-non-single-connection-situation and of course the mentioned url: http://netty.io/docs/stable/api/org/jboss/netty/channel/ChannelHandler.Sharable.html 2.the evidence showing the new bug Line 183-185 of NettyConsumer.java in version 2.9.2 ant 2.10: --------------------------------------------------------------------------------------------------- // must get the pipeline from the factory when opening a new connection ChannelPipeline serverPipeline = pipelineFactory.getPipeline(this); serverBootstrap.setPipeline(serverPipeline); --------------------------------------------------------------------------------------------------- The netty javadoc for ServerBootStrap.setPipeline: --------------------------------------------------------------------------------------- public void setPipeline(ChannelPipeline pipeline) Sets the default ChannelPipeline which is cloned when a new Channel is created. Bootstrap creates a new pipeline which has the same entries with the specified pipeline for a new channel. Calling this method also sets the pipelineFactory property to an internal ChannelPipelineFactory implementation which returns a shallow copy of the specified pipeline. Please note that this method is a convenience method that works only when 1) you create only one channel from this bootstrap (e.g. one-time client-side or connectionless channel) or 2) the ChannelPipelineCoverage of all handlers in the pipeline is "all". You have to use setPipelineFactory(ChannelPipelineFactory) if 1) your pipeline contains a ChannelHandler whose ChannelPipelineCoverage is "one" and 2) one or more channels are going to be created by this bootstrap (e.g. server-side channels). ---------------------------------------------------------------------------------------- So you are setting the pipeline to the serverbootstrap for netty consumer (which opens server-side channels), simply breaks the second situation when "You have to use setPipelineFactory(ChannelPipelineFactory)". However, the implementation in 2.9.1 and before is correct. > camel-netty can't distinguish between Sharable and Unsharable codecs > -------------------------------------------------------------------- > > Key: CAMEL-5225 > URL: https://issues.apache.org/jira/browse/CAMEL-5225 > Project: Camel > Issue Type: Bug > Components: camel-netty > Affects Versions: 2.9.2 > Environment: ALL > Reporter: edge wang > Assignee: Claus Ibsen > Labels: netty > Fix For: 2.10.0 > > Attachments: DefaultServerPipelineFactory.java.patch, > UnsharableCodecsConflictsTest.java, UnsharableCodecsConflictsTest.java > > > Camel-netty uses general configuration model for referenced encoders/decoders > for channel pipelines, see DefaultServerPipelineFactory. That is, create > encoder/decoder objects at configuration parsing time and store them in a > list, then use them when a pipeline is established. However, this will make > encoder/decoder objects shared among different pipelines, that may cause data > conflicts, when the encoder/decoder is not Sharable(has object status/not > annotated as @Sharable), e.g. a LengthFieldBasedFrameDecoder. > Although we can avoid the problem by totally writing a new > serverpipelinefactory for our apps, several problem still remains, please see > detailed description and testcase for this bug at: > http://camel.465427.n5.nabble.com/camel-netty-bug-and-the-need-of-best-practice-for-creating-referenced-parameter-object-on-looking-up-td5627926.html -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira