In DBPortPool the PlatformMBeanServer can collide with other connection pool object names

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Monitoring
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In DBPortPool, this pulls the global MBean server:

      temp = ManagementFactory.getPlatformMBeanServer();
      

      The object name is created here:

              private ObjectName createObjectName( ServerAddress addr ) throws MalformedObjectNameException {
                  String name =  "com.mongodb:type=ConnectionPool,host=" + addr.toString().replace( ":" , ",port=" ) + ",instance=" + _serial;
                  if ( _options.description != null )
                      name += ",description=" + _options.description;
                  return new ObjectName( name );
              }
      

      If you have multiple Mongo objects connecting to the same server, there can be collision because the _serial values start at the same counter (zero). This could be a problem if multiple web-apps are hosted in the same JVM (and connect to the same server).

      Adding thread id may help with this...

              Assignee:
              Unassigned
              Reporter:
              Ryan Nitz
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: