Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-5812

Netty Event Loop Resource Leak on synchronous MongoClient Close

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 5.0.0
    • Component/s: None
    • None
    • None
    • Java Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      When creating a MongoClient with NettyTransportSettings where the eventLoopGroup is created by default in the driver, closing the client does not properly shut down the event loop threads, causing the application to hang.

      Steps to Reproduce:

      //Create a MongoClient using NettyTransportSettings:
      MongoClient mongoClient = MongoClients.create(MongoClientSettings.builder() .transportSettings(TransportSettings.nettyBuilder().build()) .build());
      
      //Perfrorm any IO operation
      mongoClient.getDatabase("test").getCollection("test").find().forEach(System.out::println);
      
      //Close the client
      mongoClient.close();

      Expected Behavior:

      • The synchronous/legacy MongoClient.close() call should shut down any event loop threads created by the driver when the eventLoopGroup was not explicitly provided.

      Actual Behavior:

      • The application hangs because the event loop threads remain active after closing the client.

            Assignee:
            slav.babanin@mongodb.com Slav Babanin
            Reporter:
            slav.babanin@mongodb.com Slav Babanin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              None
              None
              None
              None