<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:02:45 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>[SERVER-3321] Server begin to refuse connections after 200</title>
                <link>https://jira.mongodb.org/browse/SERVER-3321</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;If I connect to mongodb quickly in very short time. Mongodb server will soon be un-responsable and pymongo driver will raise an exception&lt;/p&gt;

&lt;p&gt;even I tried sleep 1 sec, After about 200 connections mongo server begin to refuse connections&lt;/p&gt;

&lt;p&gt;I have a production server splited in several processes when they connect to mongodb at the same time the problem will show up&lt;/p&gt;

&lt;p&gt;reproduce the problem use the code below&lt;br/&gt;
macbook pro&lt;/p&gt;

&lt;p&gt;from pymongo.errors import OperationFailure, AutoReconnect&lt;br/&gt;
from pymongo import Connection&lt;br/&gt;
import time&lt;/p&gt;

&lt;p&gt;l = []&lt;br/&gt;
for i in xrange(5000):&lt;br/&gt;
    conn = Connection(&apos;localhost&apos;,45678)&lt;br/&gt;
    #time.sleep(1)#remove comment will make to 200 conns&lt;br/&gt;
    l.append(conn)&lt;br/&gt;
time.sleep(300)&lt;/p&gt;</description>
                <environment>linux macos</environment>
        <key id="18610">SERVER-3321</key>
            <summary>Server begin to refuse connections after 200</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="9">Done</resolution>
                                        <assignee username="scotthernandez">Scott Hernandez</assignee>
                                    <reporter username="dawn">davyzhang</reporter>
                        <labels>
                            <label>connection</label>
                    </labels>
                <created>Thu, 23 Jun 2011 15:29:31 +0000</created>
                <updated>Mon, 29 Aug 2011 15:56:32 +0000</updated>
                            <resolved>Thu, 23 Jun 2011 15:53:12 +0000</resolved>
                                    <version>1.8.1</version>
                                                    <component>Networking</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="38897" author="dawn" created="Thu, 23 Jun 2011 15:57:33 +0000"  >&lt;p&gt;OK, my bad, its a false alert. I didn&apos;t check the real connection numbers. sorry and thanks for you advice and timing answer&lt;/p&gt;</comment>
                            <comment id="38896" author="dawn" created="Thu, 23 Jun 2011 15:54:08 +0000"  >&lt;p&gt; if I don&apos;t sleep 1 sec it will refuse connection very quickly. say about 5 more connections &lt;/p&gt;</comment>
                            <comment id="38895" author="dawn" created="Thu, 23 Jun 2011 15:52:16 +0000"  >&lt;p&gt;&amp;gt; db.serverStatus()&lt;br/&gt;
{&lt;br/&gt;
	&quot;host&quot; : &quot;mbp:45678&quot;,&lt;br/&gt;
	&quot;version&quot; : &quot;1.8.1&quot;,&lt;br/&gt;
	&quot;process&quot; : &quot;mongod&quot;,&lt;br/&gt;
	&quot;uptime&quot; : 278211,&lt;br/&gt;
	&quot;uptimeEstimate&quot; : 153403,&lt;br/&gt;
	&quot;localTime&quot; : ISODate(&quot;2011-06-23T15:51:36.778Z&quot;),&lt;br/&gt;
	&quot;globalLock&quot; : {&lt;br/&gt;
		&quot;totalTime&quot; : 278211341291,&lt;br/&gt;
		&quot;lockTime&quot; : 92047736,&lt;br/&gt;
		&quot;ratio&quot; : 0.00033085544094955163,&lt;br/&gt;
		&quot;currentQueue&quot; : &lt;/p&gt;
{
			&quot;total&quot; : 0,
			&quot;readers&quot; : 0,
			&quot;writers&quot; : 0
		}
&lt;p&gt;,&lt;br/&gt;
		&quot;activeClients&quot; : &lt;/p&gt;
{
			&quot;total&quot; : 0,
			&quot;readers&quot; : 0,
			&quot;writers&quot; : 0
		}
&lt;p&gt;	},&lt;br/&gt;
	&quot;mem&quot; : &lt;/p&gt;
{
		&quot;bits&quot; : 64,
		&quot;resident&quot; : 5,
		&quot;virtual&quot; : 5151,
		&quot;supported&quot; : true,
		&quot;mapped&quot; : 2719
	}
&lt;p&gt;,&lt;br/&gt;
	&quot;connections&quot; : &lt;/p&gt;
{
		&quot;current&quot; : 2,
		&quot;available&quot; : 202
	}
&lt;p&gt;,&lt;br/&gt;
	&quot;extra_info&quot; : &lt;/p&gt;
{
		&quot;note&quot; : &quot;fields vary by platform&quot;
	}
&lt;p&gt;,&lt;br/&gt;
	&quot;indexCounters&quot; : {&lt;br/&gt;
		&quot;btree&quot; : &lt;/p&gt;
{
			&quot;accesses&quot; : 0,
			&quot;hits&quot; : 0,
			&quot;misses&quot; : 0,
			&quot;resets&quot; : 0,
			&quot;missRatio&quot; : 0
		}
&lt;p&gt;	},&lt;br/&gt;
	&quot;backgroundFlushing&quot; : &lt;/p&gt;
{
		&quot;flushes&quot; : 2584,
		&quot;total_ms&quot; : 117344049,
		&quot;average_ms&quot; : 45411.78366873065,
		&quot;last_ms&quot; : 78,
		&quot;last_finished&quot; : ISODate(&quot;2011-06-23T15:51:12.274Z&quot;)
	}
&lt;p&gt;,&lt;br/&gt;
	&quot;cursors&quot; : &lt;/p&gt;
{
		&quot;totalOpen&quot; : 0,
		&quot;clientCursors_size&quot; : 0,
		&quot;timedOut&quot; : 2
	}
&lt;p&gt;,&lt;br/&gt;
	&quot;network&quot; : &lt;/p&gt;
{
		&quot;bytesIn&quot; : 132574722,
		&quot;bytesOut&quot; : 18154024,
		&quot;numRequests&quot; : 1702340
	}
&lt;p&gt;,&lt;br/&gt;
	&quot;repl&quot; : &lt;/p&gt;
{
		&quot;ismaster&quot; : true
	}
&lt;p&gt;,&lt;br/&gt;
	&quot;opcounters&quot; : &lt;/p&gt;
{
		&quot;insert&quot; : 1600152,
		&quot;query&quot; : 12422,
		&quot;update&quot; : 0,
		&quot;delete&quot; : 0,
		&quot;getmore&quot; : 64451,
		&quot;command&quot; : 13023
	}
&lt;p&gt;,&lt;br/&gt;
	&quot;asserts&quot; : &lt;/p&gt;
{
		&quot;regular&quot; : 0,
		&quot;warning&quot; : 0,
		&quot;msg&quot; : 0,
		&quot;user&quot; : 1,
		&quot;rollovers&quot; : 0
	}
&lt;p&gt;,&lt;br/&gt;
	&quot;writeBacksQueued&quot; : false,&lt;br/&gt;
	&quot;ok&quot; : 1&lt;br/&gt;
}&lt;/p&gt;</comment>
                            <comment id="38894" author="scotthernandez" created="Thu, 23 Jun 2011 15:52:06 +0000"  >&lt;p&gt;Please post the data from that command. Mongostat numbers are not the same, or useful here.&lt;/p&gt;

&lt;p&gt;(on my osx machine it is 204 by default, since max open files per process is 256)&lt;br/&gt;
&amp;gt; db.serverStatus().connections&lt;/p&gt;
{ &quot;current&quot; : 2, &quot;available&quot; : 202 }

&lt;p&gt;If you want more connections on osx (and on linux) you can increase your max open files: ulimit -n will tell you the number.&lt;/p&gt;</comment>
                            <comment id="38893" author="dawn" created="Thu, 23 Jun 2011 15:41:30 +0000"  >&lt;p&gt;actually I didn&apos;t see the serverStatus in shell, but I opened a mongostat here is the result nearly the break point&lt;/p&gt;

&lt;p&gt;insert  query update delete getmore command flushes mapped  vsize    res locked % idx miss %     qr|qw   ar|aw  netIn netOut  conn repl       time &lt;br/&gt;
     0      0      0      0       0       2       0  2.66g  5.13g     9m        0          0       0|0     0|0   120b     1k   196     M   23:16:15 &lt;br/&gt;
     0      0      0      0       0       2       0  2.66g  5.13g     9m        0          0       0|0     0|0   120b     1k   197     M   23:16:16 &lt;br/&gt;
     0      0      0      0       0       2       0  2.66g  5.13g     9m        0          0       0|0     0|0   120b     1k   198     M   23:16:17 &lt;br/&gt;
     0      0      0      0       0       2       0  2.66g  5.13g     9m        0          0       0|0     0|0   120b     1k   199     M   23:16:18 &lt;br/&gt;
     0      0      0      0       0       2       0  2.66g  5.13g     9m        0          0       0|0     0|0   120b     1k   200     M   23:16:19 &lt;br/&gt;
     0      0      0      0       0       2       0  2.66g  5.13g     9m        0          0       0|0     0|0   120b     1k   201     M   23:16:20 &lt;br/&gt;
     0      0      0      0       0       2       0  2.66g  5.13g     9m        0          0       0|0     0|0   120b     1k   202     M   23:16:21 &lt;br/&gt;
     0      0      0      0       0       2       0  2.66g  5.13g     9m        0          0       0|0     0|0   120b     1k   203     M   23:16:22 &lt;br/&gt;
     0      0      0      0       0       2       0  2.66g  5.13g     9m        0          0       0|0     0|0   120b     1k   204     M   23:16:23 &lt;br/&gt;
     0      0      0      0       0       1       0  2.66g  5.03g     5m        0          0       0|0     0|0    62b     1k     2       M   23:16:24 &lt;/p&gt;</comment>
                            <comment id="38890" author="scotthernandez" created="Thu, 23 Jun 2011 15:36:38 +0000"  >&lt;p&gt;Please post db.serverStatus()? &lt;/p&gt;

&lt;p&gt;Generally it is best to share a Connection and not to create lots of them. Each Connection has a pool of sockets to the server.&lt;br/&gt;
&lt;a href=&quot;http://api.mongodb.org/python/current/api/pymongo/connection.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://api.mongodb.org/python/current/api/pymongo/connection.html&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="38887" author="dawn" created="Thu, 23 Jun 2011 15:31:00 +0000"  >&lt;p&gt;if I ignored this exception and continue retry, it will finally made connection and done, but it took long time to finish&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 23 Jun 2011 15:36:38 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 34 weeks, 6 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ian@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            12 years, 34 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>dawn</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrox2f:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrirpr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>23143</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|ht0ejr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>