<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:57:39 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[JAVA-2609] mongo throws IllegalStateException: state should be: open</title>
                <link>https://jira.mongodb.org/browse/JAVA-2609</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I meet IllegalStateException: state should be: open and wonder how to solve it. Below is more context:&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo context&amp;#93;&lt;/span&gt; &lt;br/&gt;
mongo replica set: 3 nodes&lt;br/&gt;
version: 3.4 with WiredTiger&lt;br/&gt;
mongo driver in the app: java driver&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;app context&amp;#93;&lt;/span&gt;&lt;br/&gt;
We have 12 workers to process log and write/read related information to mongo. Each worker has multiple threads.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;operation&amp;#93;&lt;/span&gt;&lt;br/&gt;
MongoCursor&amp;lt;BasicDBObject&amp;gt; cursor = getArrayCollection().aggregate(aggregateParams, BasicDBObject.class).iterator();&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;log&amp;#93;&lt;/span&gt;&lt;br/&gt;
2017-09-15 17:57:17.505 ERROR 14373 &lt;span class=&quot;error&quot;&gt;&amp;#91;SQSConsumerFixed-18&amp;#93;&lt;/span&gt; &amp;#8212; c.p.s.worker.sqs.DiagLogWorkerHandler   :&lt;span class=&quot;error&quot;&gt;&amp;#91;2118482-264832996-317561309355740509, OSDiagLogWorkerHandler&amp;#93;&lt;/span&gt; Got exception that will be reprocessed &lt;br/&gt;
java.lang.IllegalStateException: state should be: open&lt;br/&gt;
        at com.mongodb.assertions.Assertions.isTrue(Assertions.java:70)&lt;br/&gt;
        at com.mongodb.connection.BaseCluster.selectServer(BaseCluster.java:82)&lt;br/&gt;
        at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.&amp;lt;init&amp;gt;(ClusterBinding.java:75)&lt;br/&gt;
        at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.&amp;lt;init&amp;gt;(ClusterBinding.java:71)&lt;br/&gt;
        at com.mongodb.binding.ClusterBinding.getReadConnectionSource(ClusterBinding.java:63)&lt;br/&gt;
        at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:402)&lt;br/&gt;
        at com.mongodb.operation.AggregateOperation.execute(AggregateOperation.java:253)&lt;br/&gt;
        at com.mongodb.operation.AggregateOperation.execute(AggregateOperation.java:67)&lt;br/&gt;
        at com.mongodb.Mongo.execute(Mongo.java:836)&lt;br/&gt;
        at com.mongodb.Mongo$2.execute(Mongo.java:823)&lt;br/&gt;
        at com.mongodb.OperationIterable.iterator(OperationIterable.java:47)&lt;br/&gt;
        at com.mongodb.AggregateIterableImpl.iterator(AggregateIterableImpl.java:123)&lt;br/&gt;
        at com.purestorage.spog.array.ArrayInfoDaoImpl.getArrays_aroundBody0(ArrayInfoDaoImpl.java:122)&lt;br/&gt;
        at com.purestorage.spog.array.ArrayInfoDaoImpl.getArrays_aroundBody1$advice(ArrayInfoDaoImpl.java:31)&lt;br/&gt;
        at com.purestorage.spog.array.ArrayInfoDaoImpl.getArrays(ArrayInfoDaoImpl.java:1)&lt;br/&gt;
        at com.purestorage.spog.worker.diagnostics.FreqDiagLogProcessorBase.isLatestDiag(FreqDiagLogProcessorBase.java:127)&lt;br/&gt;
        at com.purestorage.spog.worker.diagnostics.OSFreqDiagLogProcessor.processDiagnosticLog_aroundBody0(OSFreqDiagLogProcessor.java:129)&lt;br/&gt;
        at com.purestorage.spog.worker.diagnostics.OSFreqDiagLogProcessor.processDiagnosticLog_aroundBody1$advice(OSFreqDiagLogProcessor.java:31)&lt;br/&gt;
        at com.purestorage.spog.worker.diagnostics.OSFreqDiagLogProcessor.processDiagnosticLog(OSFreqDiagLogProcessor.java:1)&lt;br/&gt;
        at com.purestorage.spog.worker.sqs.DiagLogWorkerHandler.processDiagnosticsLog(DiagLogWorkerHandler.java:255)&lt;br/&gt;
        at com.purestorage.spog.worker.sqs.DiagLogWorkerHandler.onHandle(DiagLogWorkerHandler.java:173)&lt;br/&gt;
        at com.purestorage.spog.worker.sqs.OSDiagLogWorkerHandler.onHandle_aroundBody0(OSDiagLogWorkerHandler.java:43)&lt;br/&gt;
        at com.purestorage.spog.worker.sqs.OSDiagLogWorkerHandler.onHandle_aroundBody1$advice(OSDiagLogWorkerHandler.java:31)&lt;br/&gt;
        at com.purestorage.spog.worker.sqs.OSDiagLogWorkerHandler.onHandle(OSDiagLogWorkerHandler.java:1)&lt;br/&gt;
        at com.purestorage.sqshandler.SQSConsumerFixed$SQSWorkerRunnable.lambda$processMessage$0(SQSConsumerFixed.java:220)&lt;br/&gt;
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)&lt;br/&gt;
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)&lt;br/&gt;
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)&lt;br/&gt;
        at java.lang.Thread.run(Thread.java:745)&lt;/p&gt;</description>
                <environment></environment>
        <key id="430564">JAVA-2609</key>
            <summary>mongo throws IllegalStateException: state should be: open</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13202">Works as Designed</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="Wu">Hongkai Wu [X]</reporter>
                        <labels>
                    </labels>
                <created>Thu, 21 Sep 2017 18:49:34 +0000</created>
                <updated>Fri, 27 Oct 2023 13:21:10 +0000</updated>
                            <resolved>Tue, 3 Oct 2017 13:10:27 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3094641" author="JIRAUSER1252313" created="Tue, 19 May 2020 12:22:41 +0000"  >&lt;p&gt;How did you fix that?&lt;/p&gt;</comment>
                            <comment id="1687672" author="jeff.yemin" created="Tue, 3 Oct 2017 13:10:27 +0000"  >&lt;p&gt;I&apos;m glad you worked it out.   Good luck!&lt;/p&gt;</comment>
                            <comment id="1679180" author="wu" created="Thu, 21 Sep 2017 20:24:41 +0000"  >&lt;p&gt;Hi Jeff, &lt;br/&gt;
Thank you so much for this info. You are right. The problem is from Spring side.&lt;br/&gt;
Somehow Springboot automatically tries to close the MongoClient and re-initialize the bean. This cause the problem.&lt;/p&gt;</comment>
                            <comment id="1679136" author="jeff.yemin" created="Thu, 21 Sep 2017 19:46:50 +0000"  >&lt;p&gt;This generally happens when another part of the application has closed the MongoClient via MongoClient#close.  The application must ensure that a MongoClient is not used after it&apos;s been closed.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|ht753r:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>