If the wrapped MessageToMessageEncoder is sharable it should work. Let me fix this. In the meantime you can just create a new instance every time.
> On 21. Feb 2017, at 18:52, Joseph Madden <[email protected]> wrote: > > Hi, > > When binding an Epoll Datagram Bootstrap, if EpollChannelOption.SO_REUSEPORT > is enabled and the epoll eventLoopGroup thread count is set to > 1, the > following warning and exception is observed in my application log. > > 2017-02-21 17:34:19.367 WARN 31685 --- [ntLoopGroup-2-2] > io.netty.channel.ChannelInitializer : Failed to initialize a channel. > Closing: [id: 0xfc5ace34] > > io.netty.channel.ChannelPipelineException: > io.netty.handler.codec.DatagramPacketEncoder is not a @Sharable handler, so > can't be added or removed multiple times. > at > io.netty.channel.DefaultChannelPipeline.checkMultiplicity(DefaultChannelPipeline.java:587) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.DefaultChannelPipeline.addLast(DefaultChannelPipeline.java:199) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.DefaultChannelPipeline.addLast(DefaultChannelPipeline.java:392) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.DefaultChannelPipeline.addLast(DefaultChannelPipeline.java:379) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at MyChannelInitializer.initChannel() > at > io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:113) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:105) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:597) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.DefaultChannelPipeline.access$000(DefaultChannelPipeline.java:44) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1387) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1122) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:647) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:506) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:419) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:478) > [netty-all-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) > [netty-common-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) > [netty-common-4.1.8.Final.jar!/:4.1.8.Final] > at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:304) > [netty-transport-native-epoll-4.1.8.Final-linux-x86_64.jar!/:4.1.8.Final] > at > io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) > [netty-common-4.1.8.Final.jar!/:4.1.8.Final] > at > io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) > [netty-common-4.1.8.Final.jar!/:4.1.8.Final] > at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111] > > I have a single ChannelInitializer (MyChannelInitializer). The initChannel > method is invoked by each thread in the EventLoopGroup. It succeeds for > thread eventLoopGroup-2-1 but appears to fail for eventLoopGroup-2-2. > > java version "1.8.0_111" > Java(TM) SE Runtime Environment (build 1.8.0_111-b14) > Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode) > > Netty : 4.1.8.Final > > Is this expected behaviour? > > Regards, > > Joe > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Netty discussions" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/netty/c76e9e07-862b-44b5-ae4e-4c2c70cd9864%40googlegroups.com > > <https://groups.google.com/d/msgid/netty/c76e9e07-862b-44b5-ae4e-4c2c70cd9864%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "Netty discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/netty/BBF9BB9B-0CA1-4AD2-9738-54A857EACE72%40googlemail.com. For more options, visit https://groups.google.com/d/optout.
