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

fetchMaxBsonObjectSize incorrectly assumes access to the admin database

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.5.3
    • Connection Management
    • Using the library via the Casbah Scala library

    Description

      Some Mongo database servers do not give average accounts access to the admin database. This causes problems when attempting to make an authorized connection to a normal database.

      When attempting to connect to such a machine, I get errors like this:

      {{Jan 11, 2012 3:56:24 PM com.mongodb.DBTCPConnector fetchMaxBsonObjectSize
      WARNING: null
      java.io.IOException: couldn't connect to [/0.0.39.87:27017] bc:java.net.SocketException: Invalid argument or cannot assign requested address
      at com.mongodb.DBPort._open(DBPort.java:206)
      at com.mongodb.DBPort.go(DBPort.java:94)
      at com.mongodb.DBPort.go(DBPort.java:75)
      at com.mongodb.DBPort.findOne(DBPort.java:129)
      at com.mongodb.DBPort.runCommand(DBPort.java:138)
      at com.mongodb.DBTCPConnector.fetchMaxBsonObjectSize(DBTCPConnector.java:409)
      at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:396)
      at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:192)
      at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:295)
      at com.mongodb.DB.command(DB.java:152)
      at com.mongodb.DB._doauth(DB.java:496)
      at com.mongodb.DB.authenticate(DB.java:433)
      at com.mongodb.casbah.MongoDB.authenticate(MongoDB.scala:74)}}

      I can't say what the exact solution is, but it appears that fetchMaxBsonObjectSize() returns a null in this situation, with its unexpected presence (an int is expected) then causing the exception in later commands like DB.authenticate().

      Attachments

        Activity

          People

            jeff.yemin@mongodb.com Jeffrey Yemin
            pr1001 Peter Robinett
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: