<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:13:02 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>[CDRIVER-1639] Rand used to pick Mongo server is not seeded</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-1639</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;The call to rand() used when selecting a server is unseeded (&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/a4bcfffa9c7ffa2e541a3351ec26cfad417cbdcf/src/mongoc/mongoc-topology-description.c#L693&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/blob/a4bcfffa9c7ffa2e541a3351ec26cfad417cbdcf/src/mongoc/mongoc-topology-description.c#L693&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;This tends to manifest itself as uneven balancing between nodes in a cluster.&lt;/p&gt;

&lt;p&gt;As a specific example: when libmongoc is used as part of, say, the php-driver:&lt;/p&gt;

&lt;p&gt;1. A sudden increase in traffic creates new children (e.g. Apache workers)&lt;br/&gt;
2. The new workers create new connections to mongo using the php-driver, and therefore libmongoc&lt;br/&gt;
3. All workers initially choose the same server from the cluster as the first value from rand() is always the same&lt;br/&gt;
4. One mongo node takes the vast majority of the queries - possibly causing it to become overloaded while other nodes in the cluster receive little traffic&lt;/p&gt;</description>
                <environment></environment>
        <key id="321922">CDRIVER-1639</key>
            <summary>Rand used to pick Mongo server is not seeded</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="tomnomnom">Tom Hudson</reporter>
                        <labels>
                    </labels>
                <created>Fri, 7 Oct 2016 10:47:55 +0000</created>
                <updated>Thu, 23 Feb 2017 02:44:14 +0000</updated>
                            <resolved>Thu, 13 Oct 2016 02:37:33 +0000</resolved>
                                                    <fixVersion>1.5.0</fixVersion>
                                    <component>libmongoc</component>
                                        <votes>1</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="1406995" author="xgen-internal-githook" created="Thu, 13 Oct 2016 02:37:23 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1639&quot; title=&quot;Rand used to pick Mongo server is not seeded&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1639&quot;&gt;&lt;del&gt;CDRIVER-1639&lt;/del&gt;&lt;/a&gt; seed the PRNG used to select servers&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/5f33f7d78de8c8ff250461ca5d44fe49559efa61&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/5f33f7d78de8c8ff250461ca5d44fe49559efa61&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1403419" author="jesse" created="Fri, 7 Oct 2016 21:22:19 +0000"  >&lt;p&gt;We have rand_s on Windows and rand_r everywhere else, which are good enough for server selection.&lt;/p&gt;</comment>
                            <comment id="1403369" author="derick" created="Fri, 7 Oct 2016 20:38:07 +0000"  >&lt;p&gt;That would be random_r (Linux) and random_s (Windows). Sadly, it doesn&apos;t seem that Mac OSX has either, and recommends arc4random instead (which I don&apos;t think does what we want it to do).&lt;/p&gt;</comment>
                            <comment id="1403295" author="jesse" created="Fri, 7 Oct 2016 19:52:44 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=derick&quot; class=&quot;user-hover&quot; rel=&quot;derick&quot;&gt;derick&lt;/a&gt; and I think the right thing is for the C Driver to switch from rand to using rand_r (or rand_s on Windows), with a seed that&apos;s initially the system time. Then we have a properly seed PRNG that doesn&apos;t interfere with the global &quot;rand&quot; state.&lt;/p&gt;</comment>
                            <comment id="1402757" author="tomnomnom" created="Fri, 7 Oct 2016 11:03:20 +0000"  >&lt;p&gt;PR for potential fix on GitHub: &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/pull/398&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/pull/398&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="322133">CDRIVER-1681</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="356449">CDRIVER-2067</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="328519">CDRIVER-1893</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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|hsqlbr:</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>