<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:22:59 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-10372] ReplicaSetMonitor creates a thread that references memory it does not own</title>
                <link>https://jira.mongodb.org/browse/SERVER-10372</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The ReplicaSetMonitor constructor creates a new thread that references memory belonging to the constructor thread.  If the constructor thread exits or frees the ReplicaSetMonitor, the new thread references freed memory.&lt;/p&gt;

&lt;p&gt;This is likely related to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8707&quot; title=&quot;dbclient_rs_test threading issue&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8707&quot;&gt;&lt;del&gt;SERVER-8707&lt;/del&gt;&lt;/a&gt;.  The problem was previously obscured by &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8891&quot; title=&quot;Simple client fail with segmentation fault in mongoclient library&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8891&quot;&gt;&lt;del&gt;SERVER-8891&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We need this fixed in 2.4.  The 2.4.5 C++ API is working well with older Mongo servers so we don&apos;t need this backported into 2.2.&lt;/p&gt;</description>
                <environment>Windows, Linux confirmed</environment>
        <key id="83884">SERVER-10372</key>
            <summary>ReplicaSetMonitor creates a thread that references memory it does not own</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="3">Duplicate</resolution>
                                        <assignee username="tad">Tad Marshall</assignee>
                                    <reporter username="gerry f">Gerry F</reporter>
                        <labels>
                    </labels>
                <created>Mon, 29 Jul 2013 20:13:16 +0000</created>
                <updated>Wed, 10 Dec 2014 23:06:28 +0000</updated>
                            <resolved>Tue, 6 Aug 2013 16:38:39 +0000</resolved>
                                    <version>2.2.4</version>
                    <version>2.4.5</version>
                                                    <component>Internal Client</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="397058" author="tad" created="Tue, 6 Aug 2013 16:38:39 +0000"  >&lt;p&gt;This was fixed by the commits made for linked tickets &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8707&quot; title=&quot;dbclient_rs_test threading issue&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8707&quot;&gt;&lt;del&gt;SERVER-8707&lt;/del&gt;&lt;/a&gt; and &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8891&quot; title=&quot;Simple client fail with segmentation fault in mongoclient library&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8891&quot;&gt;&lt;del&gt;SERVER-8891&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="397056" author="tad" created="Tue, 6 Aug 2013 16:37:33 +0000"  >&lt;p&gt;Hi Gerry,&lt;/p&gt;

&lt;p&gt;Thanks!  I&apos;ll resolve this ticket.&lt;/p&gt;

&lt;p&gt;Can you file tickets against the C++ driver documentation and a suggestion to make ReplicaSetMonitorWatcher more manageable?  I think that Randolph is also hoping to address ReplicaSetMonitorWatcher ... it&apos;s the thread that crashes in the remaining problem in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8707&quot; title=&quot;dbclient_rs_test threading issue&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8707&quot;&gt;&lt;del&gt;SERVER-8707&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Tad&lt;/p&gt;</comment>
                            <comment id="396997" author="gerry f" created="Tue, 6 Aug 2013 15:45:19 +0000"  >&lt;p&gt;Hi Tad,&lt;/p&gt;

&lt;p&gt;I think this ticket can be closed.&lt;/p&gt;

&lt;p&gt;There are two issues remaining, but maybe they should get their own tickets:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;The C++ driver documentation needs some love, with additional detail on when and when not to call functions.  Also, the connect/disconnect workflow is not obvious.&lt;/li&gt;
	&lt;li&gt;IF the watcher thread is necessary, and IF BackgroundJob is the right way to start that thread, then I think we need a way to tell that thread it should die the next time it wakes.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Looking forward to 2.4.6,&lt;br/&gt;
Gerry&lt;/p&gt;</comment>
                            <comment id="396783" author="tad" created="Tue, 6 Aug 2013 11:32:11 +0000"  >&lt;p&gt;Hi Gerry,&lt;/p&gt;

&lt;p&gt;The remaining issues in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8707&quot; title=&quot;dbclient_rs_test threading issue&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8707&quot;&gt;&lt;del&gt;SERVER-8707&lt;/del&gt;&lt;/a&gt; are looking like a bug in the &quot;mock&quot; replica sets used by that test, so if there are remaining issues in this ticket I think that they are distinct from the remaining issues in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8707&quot; title=&quot;dbclient_rs_test threading issue&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8707&quot;&gt;&lt;del&gt;SERVER-8707&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;All of the fixes found so far have been backported to the 2.4 branch and will be in version 2.4.6.&lt;/p&gt;

&lt;p&gt;If you don&apos;t call ReplicaSetMonitor::remove() (which I don&apos;t think is something that users of the C++ driver should do), are there still issues to be fixed for this ticket?&lt;/p&gt;

&lt;p&gt;Tad&lt;/p&gt;</comment>
                            <comment id="393143" author="gerry f" created="Wed, 31 Jul 2013 22:42:26 +0000"  >&lt;p&gt;I was using ReplicaSetMonitor::remove() based on some older sample code in the hopes that it would prevent our ReplicaSetMonitor related crashes.&lt;/p&gt;

&lt;p&gt;In testing today, it has become clear that the ReplicaSetMonitor was not the problem. Removing the ReplicaSetMonitor caused the Watcher thread to do nothing every ten seconds, instead of referencing damaged memory every ten seconds.  Basically, it hid the symptoms of an unrelated bug.&lt;/p&gt;

&lt;p&gt;Sometimes when I started a second connection to the same replica server, I would get memory trashing.  This doesn&apos;t show up in Dr Memory or valgrind, because it is valid memory being changed.&lt;/p&gt;

&lt;p&gt;If I copy the dbclient_rs.cpp and dbclient_rs.h fixes for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8891&quot; title=&quot;Simple client fail with segmentation fault in mongoclient library&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8891&quot;&gt;&lt;del&gt;SERVER-8891&lt;/del&gt;&lt;/a&gt; into my 2.4.5 directory and remake, the memory corruption doesn&apos;t happen.  I cannot see that there any changes in these two files that could possibly affect this, but....&lt;/p&gt;

&lt;p&gt;In summary, the &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8891&quot; title=&quot;Simple client fail with segmentation fault in mongoclient library&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8891&quot;&gt;&lt;del&gt;SERVER-8891&lt;/del&gt;&lt;/a&gt; fix is good and also mysteriously fixes a memory trashing problem in my application.  The &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8707&quot; title=&quot;dbclient_rs_test threading issue&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8707&quot;&gt;&lt;del&gt;SERVER-8707&lt;/del&gt;&lt;/a&gt; bug is real and annoying.  The second way of reproducing this bug is simply a way to destroy the memory used by the watcher thread while the process continues.  I think this bug can be considered a duplicate of 8707.&lt;/p&gt;</comment>
                            <comment id="393079" author="tad" created="Wed, 31 Jul 2013 20:56:11 +0000"  >&lt;p&gt;Hi Gerry,&lt;/p&gt;

&lt;p&gt;Thanks for the sample program!&lt;/p&gt;

&lt;p&gt;I discussed the correct usage of ReplicaSetMonitor with another developer here, and he shares my feeling that this API (ReplicaSetMonitor::remove) was never intended to be called by C++ driver users.  I also talked to people in our documentation group and confirmed my impression that the C++ driver was more-or-less undocumented, and so users are probably reading MongoDB source code to try to figure out how to use the C++ driver.&lt;/p&gt;

&lt;p&gt;I apologize for the poor state of information on proper use of callable functions in the C++ driver.&lt;/p&gt;

&lt;p&gt;I&apos;ll try your sample program and see if I can make MongoDB more defensive against calls like this.&lt;/p&gt;

&lt;p&gt;In the meantime, can you describe what you are trying to accomplish in removing the replica set that is being used by the DBClientReplicaSet that you created?  There may be a better way to do it that will not require additional defensive code in the C++ driver.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;

&lt;p&gt;Tad&lt;/p&gt;</comment>
                            <comment id="393059" author="gerry f" created="Wed, 31 Jul 2013 20:36:03 +0000"  >&lt;p&gt;This simple test case works correctly, except for a rare crash on exit (1 crash in over 30 runs).  Running in valgrind seems to get luckier, at over 60 runs without an exit crash or invalid memory access.&lt;/p&gt;

&lt;p&gt;Clearly, the added complexity of the real application matters.  &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;// SERVER-10372&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;#include &amp;lt;mongo/client/dbclient.h&amp;gt;&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;using namespace mongo;&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;&amp;nbsp;&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;int main() {&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;&amp;nbsp;&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;    std::vector&amp;lt;HostAndPort&amp;gt; hosts;&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;       hosts.push_back(HostAndPort(&quot;192.168.202.249:27017&quot;));&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;       hosts.push_back(HostAndPort(&quot;192.168.202.249:27018&quot;));&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;       hosts.push_back(HostAndPort(&quot;192.168.202.249:27020&quot;));&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;&amp;nbsp;&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;       DBClientReplicaSet connection(&quot;rs0&quot;, hosts);&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;       connection.connect();&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;&amp;nbsp;&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;       mongo::sleepsecs(12);&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;&amp;nbsp;&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;       mongo::ReplicaSetMonitor::remove(&quot;rs0&quot;, true);&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;&amp;nbsp;&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;       mongo::sleepsecs(30);&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;&amp;nbsp;&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;}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                            <comment id="392841" author="gerry f" created="Wed, 31 Jul 2013 16:43:41 +0000"  >&lt;p&gt;My current test case is too embedded in a tool environment to share nicely.&lt;/p&gt;

&lt;p&gt;While I am trying to cut my test case down, you might try this:&lt;br/&gt;
Make a connection to a replica set.&lt;br/&gt;
Disconnect from the replica set.&lt;br/&gt;
Call ReplicatSetMonitor::remove().&lt;br/&gt;
Call sleep for 20 seconds.&lt;/p&gt;

&lt;p&gt;If I am right about what the problem is, this simple test will read freed memory and be detectable in valgrind.&lt;/p&gt;

&lt;p&gt;It will take me a while to convert my test case to something you can run, but it is priority one.&lt;/p&gt;</comment>
                            <comment id="392777" author="tad" created="Wed, 31 Jul 2013 15:35:09 +0000"  >&lt;p&gt;Hi Gerry,&lt;/p&gt;

&lt;p&gt;Thanks for this bug report.&lt;/p&gt;

&lt;p&gt;As you know from &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8891&quot; title=&quot;Simple client fail with segmentation fault in mongoclient library&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8891&quot;&gt;&lt;del&gt;SERVER-8891&lt;/del&gt;&lt;/a&gt;, we&apos;ve had a long-standing problem with static objects being destroyed in an &quot;incorrect&quot; order in which later-destroyed objects reference objects that were destroyed earlier.  Our &quot;fix&quot; for this in the MongoDB server has been to always exit by calling _exit(), which prevents any static destructors from running.  Imposing this requirement on users of the C++ driver has seemed onerous, so we&apos;re trying to eliminate the crashes by making cleanup more predictable in the cases that we can identify.&lt;/p&gt;

&lt;p&gt;There is a remaining problem with the ReplicaSetMonitorWatcher thread, because the thread doesn&apos;t terminate until after the object containing the data it uses has been destroyed.  This only causes problems intermittently, because of the 10 second sleep that this thread does on each pass; if the process termination happens while the thread is sleeping, nothing bad happens.  When the termination happens when the thread is &lt;b&gt;not&lt;/b&gt; in the sleep, we get the problems seen in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8707&quot; title=&quot;dbclient_rs_test threading issue&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8707&quot;&gt;&lt;del&gt;SERVER-8707&lt;/del&gt;&lt;/a&gt;, including things like &quot;src/third_party/boost/boost/thread/pthread/mutex.hpp:154: void boost::timed_mutex::lock(): Assertion `!pthread_mutex_lock(&amp;amp;m)&apos; failed.&quot;.&lt;/p&gt;

&lt;p&gt;I think that you are describing a different problem.  You mentioned calling remove() on a ReplicaSetMonitor and then waiting 10 seconds (the duration of the sleep in ReplicaSetMonitorWatcher&apos;s loop) so it sounds like this is not the process termination case described in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8707&quot; title=&quot;dbclient_rs_test threading issue&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8707&quot;&gt;&lt;del&gt;SERVER-8707&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Can you describe the steps to reproduce the problem you are seeing, or post sample code that we can use to reproduce the problem?&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;

&lt;p&gt;Tad&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="66324">SERVER-8707</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="67624">SERVER-8891</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 29 Jul 2013 20:42:08 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        10 years, 28 weeks, 1 day 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>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            10 years, 28 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

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

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>76698</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;The simplest approach is to call mongo::ReplicaSetMonitor::remove() to destroy the referenced memory in a running process.  The new thread will reference the freed memory within 10 seconds.  &lt;/p&gt;

&lt;p&gt;Using Microsoft&apos;s ODBCtest, start and end a connection to a replica set.  When the last connection to that driver .dll is closed, the program will drop the .dll and crash the next time the new thread wakes up.&lt;/p&gt;</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10166" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Tests Written</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10153"><![CDATA[Unneeded]]></customfieldvalue>

                        </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|hspdtj:</customfieldvalue>

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