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

"IllegalStateException: open" during insert

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.12.2
    • None
    • Environment:
      Linux, Oracle JDK 7

      Saw this exception in a log file:

      2014-07-10 13:58:35,231 [http-apr-8080-exec-4] ERROR MyAppExceptionMapper - Failed to process request
      java.lang.IllegalStateException: open
              at org.bson.util.Assertions.isTrue(Assertions.java:36) ~[bson-2.12.2.jar:na]
              at com.mongodb.DBPort.runCommand(DBPort.java:196) ~[mongo-java-driver-2.12.2.jar:na]
              at com.mongodb.DBPort$NativeAuthenticator.authenticate(DBPort.java:647) ~[mongo-java-driver-2.12.2.jar:na]
              at com.mongodb.DBPort.authenticate(DBPort.java:364) ~[mongo-java-driver-2.12.2.jar:na]
              at com.mongodb.DBPort.checkAuth(DBPort.java:375) ~[mongo-java-driver-2.12.2.jar:na]
              at com.mongodb.DBTCPConnector.doOperation(DBTCPConnector.java:209) ~[mongo-java-driver-2.12.2.jar:na]
              at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:181) ~[mongo-java-driver-2.12.2.jar:na]
              at com.mongodb.DBCollectionImpl.insertWithWriteProtocol(DBCollectionImpl.java:528) ~[mongo-java-driver-2.12.2.jar:na]
              at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:193) ~[mongo-java-driver-2.12.2.jar:na]
              at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:165) ~[mongo-java-driver-2.12.2.jar:na]
              at com.mongodb.DBCollection.insert(DBCollection.java:161) ~[mongo-java-driver-2.12.2.jar:na]
              at com.mongodb.DBCollection.insert(DBCollection.java:107) ~[mongo-java-driver-2.12.2.jar:na]
              at com.mongodb.DBCollection.save(DBCollection.java:966) ~[mongo-java-driver-2.12.2.jar:na]
              at org.jongo.Insert.save(Insert.java:50) ~[jongo-1.0.jar:na]
              at org.jongo.MongoCollection.save(MongoCollection.java:128) ~[jongo-1.0.jar:na]
              at MyAppRepository.save(MyAppRepository.java:43) ~[MyAppRepository.class:na]
      ...
      

      This happened while the app was running (had been started almost exactly 20 minutes before), there was no shutdown in progress (regular application logging just continues after this). There was no IOException or similar logged.

      I did have maxConnectionIdleTime assigned to 120000 ms (2 minutes).
      This failing request failed on the first mongo query of the webapp request, about 4 seconds after the webapp request came in the IllegalArgumentException was thrown.
      The webapp request before this one was about 4 minutes earlier, so probably the max connection idle time cleanup logic had run.

      The application currently relies on catching MongoSocketException for retries, would be nice to receive that exception in this case too, if it was indeed a network-related problem.

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            stefanl Stefan Larsson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: