JIRA | Marc Esher | 6 years ago
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    There appears to be a leak in the latest Mongo Driver. It would be most pronounced in a web app where you'd have multiple instances of Mongo being created, perhaps even created over and over during development as an application is reinitialized but the server (i.e. the VM) itself isn't actually restarted. I'm doing this within the context of ColdFusion, but this would be true of any container-based java app. To replicate, you should just need to create multiple instances of Mongo (with ServerAddresses constructor) and let them go out of scope as they normally would... maybe it's a singleton object that reinitializes its internal Mongo instance or something. What I'm seeing is that those Mongo instances stay around forever. If I'm reading the output of Eclipse's Memory Analyzer correctly, it's due to ReplicaSetStatus$Updater. I haven't read the source, but it appears that this spawns a thread that presumably checks for replica set members' status. However, that's keeping these objects alive even after the request that spawned them ends. In the forums, Eliot suggested calling Mongo.close(). I did that and observed two things: 1) After doing so and taking a heap dump, the ReplicaSetStatus$Updater instances still remained. This was also evidenced by shutting down Mongo and watching the com.mongodb.ReplicaSetStatus$Node update Warning errors still appear in the app server logs 2) when initializing Mongo with a server/port and not a List of ServerAddresses, calling Mongo.close() throws an error. This is in the context of my web container. I could not replicate it in a simple standalone java example. java.lang.NullPointerException at com.mongodb.DBTCPConnector.close( at com.mongodb.Mongo.close( at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke( 25) at java.lang.reflect.Method.invoke( at

    JIRA | 6 years ago | Marc Esher
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at com.mongodb.DBTCPConnector.close()
    2. MongoDB Java Driver
      1. com.mongodb.DBTCPConnector.close(
      2. com.mongodb.Mongo.close(
      2 frames
    3. Java RT
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(
      4. java.lang.reflect.Method.invoke(
      4 frames