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

Memory leak on Java async driver + Netty 4.1.x

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.0-rc1, 3.4.0
    • Affects Version/s: 3.3.0
    • Component/s: Async
    • None
    • Environment:
      Java 8, Vert.x 3.3.2, CentOS Linux release 7.2.1511 (Core)

      We've been using Netty as the MongoDB transport in our Java application and it's been working fine.
      However, since upgrading to Netty 4.1, we began running into memory leaks.
      The errors look like the following:

      com.mongodb.MongoException: failed to allocate 16777216 byte(s) of direct memory (used: 4596957223, max: 4608491520)

      It starts happening after doing lots of Mongo queries.
      By changing the transport back to the default NIO2, the leak is gone and everything works again.

      We hope we can go back to using Netty though, as it performs better.

      The issue happened with both Netty 4.1.1 and 4.1.4. It seems related to Netty 4.1.x releases in general.
      We're using the async driver 3.3.0 and RX driver 1.2.0 (though RX is probably unrelated to the problem).

        1. TestMongoNettyLeak.java
          4 kB
          Frederico Ferro Schuh

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            fschuh Frederico Ferro Schuh
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: