Skip to content

Bootstrap shutdown should also shutdown pipeline EventExecutorGroups. #1220

d-t-w opened this Issue Apr 1, 2013 · 2 comments

2 participants

d-t-w commented Apr 1, 2013


Found in 4.0.0.Beta2:

I have a pipeline which is configured with several handlers, the last of which runs in its own EventExecutorGroup. Like so:

extractEventGroup = new DefaultEventExecutorGroup()

channelInitializer = new ChannelInitializer<SocketChannel>() {
    public void initChannel(SocketChannel ch) throws Exception {
    ChannelPipeline pipeline = ch.pipeline();
    pipeline.addLast(DECODE, new SomeHandler());
    pipeline.addLast(ENCODE, new AnotherHandler());
    pipeline.addLast(extractEventGroup, EXECUTE, new ExecuteHandler());

I create a bootstrap using with this pipeline configured in my ChannelInitializer:

ServerBootstrap bootstrap = new ServerBootstrap(); NioEventLoopGroup())

Later, when I shut the server down, I flush and close all the channels, then call:


That shuts down the NioEventLoopGroup, but not the separate extractEventGroup that I have added to the pipeline for my ChannelHandler - meaning the JVM doesn't exit as threads are still active (just waiting, but not released).

I had expected that closing the bootstrap would also close any EventExecutorGroups associated with it.

The Netty Project member
trustin commented Apr 2, 2013

This is an intentional behavior. Netty should not make an assumption that an EventExecutorGroup a user specified when adding a handler to a pipeline is being used exclusively. Otherwise, a user cannot share the executor group with other bootstraps or EventLoopGroups.

@trustin trustin closed this Apr 2, 2013
@trustin trustin was assigned Apr 2, 2013
The Netty Project member
trustin commented Apr 2, 2013

We are going to fix this problem differently - see #1224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.