GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Shutting down MultiThreadIoEventLoopGroup starts all unstarted threads · Issue #17135 · netty/netty

Shutting down MultiThreadIoEventLoopGroup starts all unstarted threads #17135

New issue
Copy link
New issue
Copy link
Open
Open
Shutting down MultiThreadIoEventLoopGroup starts all unstarted threads#17135
Copy link

Description

@mega12345mega
mega12345mega
opened on Jul 24, 2026
Issue body actions

When a MultiThreadIoEventLoopGroup is shutdown, all of the threads that were not yet started are immediately started before being shutdown.

EventLoopGroup group = new MultiThreadIoEventLoopGroup(300, NioIoHandler.newFactory());
System.out.println(Thread.activeCount()); // Prints 1
group.shutdownGracefully();
System.out.println(Thread.activeCount()); // Prints 301

I noticed this in a debugger, but it didn't cause any problems for me. Thought I should report it though.

Interestingly, when using an absurd thread count like 10,000, I found that the creation of the group is what blocked for a while rather than the shutdown itself, so it is possible that this does not have a significant impact in general.

Activity

  1. adityaanikam commented on Jul 29, 2026

    @adityaanikam
    adityaanikam
    on Jul 29, 2026
    More actions

    I looked into this. MultiThreadIoEventLoopGroup doesn't override shutdownGracefully() itself, so the behavior comes from the shared shutdown path in MultithreadEventExecutorGroup (netty common), which iterates every child executor and calls shutdownGracefully() on it directly regardless of whether that executor's worker thread has ever been started. Since each child is a lazily started SingleThreadEventExecutor, calling any method that requires the executor loop to run (including shutdown) forces it to spin up its thread just to immediately terminate.

    I'd like to work on this. Since this lives in the shared executor group base rather than anything IO specific, the same issue likely reproduces on any MultithreadEventExecutorGroup subclass, not just MultiThreadIoEventLoopGroup I'll check that before scoping a fix, since fixing it at the shared level would be more valuable than a narrow patch here. The likely direction is checking whether a child has ever been started before routing a shutdown into it, and marking never-started executors terminated directly rather than waking them up to shut down.

  2. arimu1
    added 4 commits that reference this issue on Aug 3, 2026

    SingleThreadEventExecutor: skip thread start on unused shutdown

    25e5470

    SingleThreadEventExecutor: fix never-started shutdown for IoEventLoop

    d515a51

    Document never-started group quiet-period tradeoff for netty#17135

    3d7e14d

    SingleThreadEventExecutor: honor quiet period for never-started children

    ffaa9bf
  3. arimu1
    added 4 commits that reference this issue on Aug 21, 2026

    SingleThreadEventExecutor: skip thread start on unused shutdown

    fb206da

    SingleThreadEventExecutor: fix never-started shutdown for IoEventLoop

    2aa4f08

    Document never-started group quiet-period tradeoff for netty#17135

    a9a6d4a

    SingleThreadEventExecutor: honor quiet period for never-started children

    d0ed2ad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.