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

mongo throws IllegalStateException: state should be: open

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      I meet IllegalStateException: state should be: open and wonder how to solve it. Below is more context:

      [mongo context]
      mongo replica set: 3 nodes
      version: 3.4 with WiredTiger
      mongo driver in the app: java driver

      [app context]
      We have 12 workers to process log and write/read related information to mongo. Each worker has multiple threads.

      [operation]
      MongoCursor<BasicDBObject> cursor = getArrayCollection().aggregate(aggregateParams, BasicDBObject.class).iterator();

      [log]
      2017-09-15 17:57:17.505 ERROR 14373 [SQSConsumerFixed-18] — c.p.s.worker.sqs.DiagLogWorkerHandler :[2118482-264832996-317561309355740509, OSDiagLogWorkerHandler] Got exception that will be reprocessed
      java.lang.IllegalStateException: state should be: open
      at com.mongodb.assertions.Assertions.isTrue(Assertions.java:70)
      at com.mongodb.connection.BaseCluster.selectServer(BaseCluster.java:82)
      at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:75)
      at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:71)
      at com.mongodb.binding.ClusterBinding.getReadConnectionSource(ClusterBinding.java:63)
      at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:402)
      at com.mongodb.operation.AggregateOperation.execute(AggregateOperation.java:253)
      at com.mongodb.operation.AggregateOperation.execute(AggregateOperation.java:67)
      at com.mongodb.Mongo.execute(Mongo.java:836)
      at com.mongodb.Mongo$2.execute(Mongo.java:823)
      at com.mongodb.OperationIterable.iterator(OperationIterable.java:47)
      at com.mongodb.AggregateIterableImpl.iterator(AggregateIterableImpl.java:123)
      at com.purestorage.spog.array.ArrayInfoDaoImpl.getArrays_aroundBody0(ArrayInfoDaoImpl.java:122)
      at com.purestorage.spog.array.ArrayInfoDaoImpl.getArrays_aroundBody1$advice(ArrayInfoDaoImpl.java:31)
      at com.purestorage.spog.array.ArrayInfoDaoImpl.getArrays(ArrayInfoDaoImpl.java:1)
      at com.purestorage.spog.worker.diagnostics.FreqDiagLogProcessorBase.isLatestDiag(FreqDiagLogProcessorBase.java:127)
      at com.purestorage.spog.worker.diagnostics.OSFreqDiagLogProcessor.processDiagnosticLog_aroundBody0(OSFreqDiagLogProcessor.java:129)
      at com.purestorage.spog.worker.diagnostics.OSFreqDiagLogProcessor.processDiagnosticLog_aroundBody1$advice(OSFreqDiagLogProcessor.java:31)
      at com.purestorage.spog.worker.diagnostics.OSFreqDiagLogProcessor.processDiagnosticLog(OSFreqDiagLogProcessor.java:1)
      at com.purestorage.spog.worker.sqs.DiagLogWorkerHandler.processDiagnosticsLog(DiagLogWorkerHandler.java:255)
      at com.purestorage.spog.worker.sqs.DiagLogWorkerHandler.onHandle(DiagLogWorkerHandler.java:173)
      at com.purestorage.spog.worker.sqs.OSDiagLogWorkerHandler.onHandle_aroundBody0(OSDiagLogWorkerHandler.java:43)
      at com.purestorage.spog.worker.sqs.OSDiagLogWorkerHandler.onHandle_aroundBody1$advice(OSDiagLogWorkerHandler.java:31)
      at com.purestorage.spog.worker.sqs.OSDiagLogWorkerHandler.onHandle(OSDiagLogWorkerHandler.java:1)
      at com.purestorage.sqshandler.SQSConsumerFixed$SQSWorkerRunnable.lambda$processMessage$0(SQSConsumerFixed.java:220)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)

            Assignee:
            Unassigned Unassigned
            Reporter:
            Wu Hongkai Wu [X]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: