<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:10:11 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-650] Crash in mongoc_stream_check_closed</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-650</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;Crash with backtrace like:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mongoc_stream_check_closed ()&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;_mongoc_cluster_sendv () &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;_mongoc_cursor_next ()&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mongoc_cursor_next ()&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;mongoc_stream_check_closed only checks if &quot;stream&quot; is NULL in debug mode; a release-mode driver will crash if the stream passed to function is NULL.&lt;/p&gt;

&lt;p&gt;Likely cause:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Start a cursor, complete the initial query on a primary, the cursor has a &quot;hint&quot;, the index of its server in driver&apos;s array of servers&lt;/li&gt;
	&lt;li&gt;Shut down the primary&lt;/li&gt;
	&lt;li&gt;Do another operation on the cluster, forcing the driver to reconnect and change cluster state (fewer servers, different servers, a server with a cleared stream?)&lt;/li&gt;
	&lt;li&gt;Iterate the cursor to completion - it tries to send a getmore using its &quot;hint&quot;, which may be out of bounds now, or point to a different server?, or point to a server with a NULL stream, not sure which of these three is possible&lt;/li&gt;
	&lt;li&gt;Segfault&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;There seem likely a number of ways the cursor&apos;s &quot;hint&quot; can be invalidated. Avoid crashes in all of them for the 1.1.x code.&lt;/p&gt;

&lt;p&gt;Good news - this is all completely re-architected and corrected in 1.2, but 1.2. won&apos;t be released until EOQ at the earliest.&lt;/p&gt;</description>
                <environment></environment>
        <key id="204332">CDRIVER-650</key>
            <summary>Crash in mongoc_stream_check_closed</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="jesse@mongodb.com">A. Jesse Jiryu Davis</reporter>
                        <labels>
                    </labels>
                <created>Thu, 14 May 2015 20:54:52 +0000</created>
                <updated>Wed, 19 Oct 2016 14:15:07 +0000</updated>
                            <resolved>Fri, 29 May 2015 17:00:21 +0000</resolved>
                                    <version>1.1.4</version>
                                    <fixVersion>1.1.7</fixVersion>
                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="997321" author="xgen-internal-githook" created="Wed, 5 Aug 2015 17:22:09 +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@emptysquare.net&apos;}
&lt;p&gt;Message: Merge pull request #235 from ajdavis/&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt;-crash-in-check-closed&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt; crash after replset reconnect&lt;br/&gt;
Branch: 1.2.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/53682560c307a806bb41c37232e8d4ec182df3ba&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/53682560c307a806bb41c37232e8d4ec182df3ba&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="997320" author="xgen-internal-githook" created="Wed, 5 Aug 2015 17:22:08 +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@emptysquare.net&apos;}
&lt;p&gt;Message: Merge pull request #235 from ajdavis/&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt;-crash-in-check-closed&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt; crash after replset reconnect&lt;br/&gt;
Branch: 1.2.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/53682560c307a806bb41c37232e8d4ec182df3ba&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/53682560c307a806bb41c37232e8d4ec182df3ba&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="997318" author="xgen-internal-githook" created="Wed, 5 Aug 2015 17:22:06 +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-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt; crash after replset reconnect&lt;br/&gt;
Branch: 1.2.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/aa607cdf4de5052503b867460b40c1aa52756aa2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/aa607cdf4de5052503b867460b40c1aa52756aa2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="927539" author="xgen-internal-githook" created="Fri, 29 May 2015 17:00:09 +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@emptysquare.net&apos;}
&lt;p&gt;Message: Merge pull request #235 from ajdavis/&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt;-crash-in-check-closed&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt; crash after replset reconnect&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/53682560c307a806bb41c37232e8d4ec182df3ba&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/53682560c307a806bb41c37232e8d4ec182df3ba&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="927538" author="xgen-internal-githook" created="Fri, 29 May 2015 17:00:08 +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@emptysquare.net&apos;}
&lt;p&gt;Message: Merge pull request #235 from ajdavis/&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt;-crash-in-check-closed&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt; crash after replset reconnect&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/53682560c307a806bb41c37232e8d4ec182df3ba&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/53682560c307a806bb41c37232e8d4ec182df3ba&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="927537" author="xgen-internal-githook" created="Fri, 29 May 2015 17:00:07 +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-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt; crash after replset reconnect&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/aa607cdf4de5052503b867460b40c1aa52756aa2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/aa607cdf4de5052503b867460b40c1aa52756aa2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="925242" author="jesse" created="Wed, 27 May 2015 21:03:35 +0000"  >&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/pull/235/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/pull/235/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="924922" author="jesse" created="Wed, 27 May 2015 17:54:33 +0000"  >&lt;p&gt;Attaching &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt;-2.py, which uses MockupDB to confuse the driver, and example-client.c, which can reproduce the segfault. To reproduce, install Python&apos;s &quot;pip&quot; and then install MockupDB:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;pip install git+git://github.com/ajdavis/mongo-mockup-db.git&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;Then run &quot;python &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-650&quot; title=&quot;Crash in mongoc_stream_check_closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-650&quot;&gt;&lt;del&gt;CDRIVER-650&lt;/del&gt;&lt;/a&gt;-2.py&quot;. The mock servers start up on ports 8000 and 8001.&lt;/p&gt;

&lt;p&gt;Now compile and run example-client.c. The sequence of events is:&lt;/p&gt;

&lt;p&gt;1. example-client connects with seed list &quot;secondary,primary&quot;. Nodes are arranged in the cluster&apos;s array as 0 = primary, 1 = secondary.&lt;br/&gt;
2. example-client creates cursor &amp;amp; does initial query with read pref &quot;secondary&quot;, completes initial read from secondary and stores &quot;1&quot; as its &quot;hint&quot;&lt;br/&gt;
3. Secondary shuts down, driver doesn&apos;t know it yet&lt;br/&gt;
4. example-client starts initial query with a different cursor on primary&lt;br/&gt;
5. Primary hangs up, driver gets network error and invalidates its cluster info&lt;br/&gt;
6. example-client calls mongoc_cursor_next on the secondary cursor&lt;br/&gt;
7. Driver reconnects and recreates its node list, this time without the secondary node&lt;br/&gt;
5. Driver then applies the secondary cursor&apos;s invalid hint, &quot;1&quot;, to read past the end of the nodes list&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="75915" name="CDRIVER-650-2.py" size="685" author="jesse@mongodb.com" created="Wed, 27 May 2015 17:54:33 +0000"/>
                            <attachment id="75914" name="example-client.c" size="1536" author="jesse@mongodb.com" created="Wed, 27 May 2015 17:54:33 +0000"/>
                    </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|hrf7lj:</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>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="557">C Driver 2015Q2 sprint 2</customfieldvalue>

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