<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:59:35 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>[CXX-564] getLastError() fail randomly</title>
                <link>https://jira.mongodb.org/browse/CXX-564</link>
                <project id="11980" key="CXX">C++ Driver</project>
                    <description>&lt;p&gt;I have an application - a threadpool with each worker thread maintaining it&apos;s own connection, after insert (bulk) the subsequent getLastError() call randomly fail. Here is the relavant code snippet for each worker thread:&lt;br/&gt;
static _thread mongo::DBClientConnection *mongoPtr;&lt;br/&gt;
...&lt;br/&gt;
bool event_loader::threadSpecificInit() &lt;/p&gt;
{
 //each thread call this once at thread startup
mongoPtr_ = new mongo::DBClientConnection();
...}

&lt;p&gt;void event_loader::handleInput() {&lt;br/&gt;
//each thread run this in a loop&lt;br/&gt;
try {&lt;br/&gt;
//build bulk_data&lt;br/&gt;
......&lt;br/&gt;
mongoPtr_-&amp;gt;insert(&quot;event_test.collection1&quot;, bulk_data);&lt;br/&gt;
if (!(mongoPtr_-&amp;gt;getLastError()).empty())&lt;/p&gt;
{ std::cout &amp;lt;&amp;lt; &quot;insert failed&quot; &amp;lt;&amp;lt; std::endl; 
}
&lt;p&gt; catch (const MtxUtil::Exception&amp;amp; exc)&lt;/p&gt;
{ std::cout &amp;lt;&amp;lt; &quot;Caught an exception during getLastError.\n&quot; &amp;lt;&amp;lt; &quot;Exception&apos;s what()=&quot; &amp;lt;&amp;lt; exc.what() &amp;lt;&amp;lt; std::endl; 
}
&lt;p&gt; catch (...) &lt;/p&gt;
{
std::cout &amp;lt;&amp;lt; &quot;Caught an unknown exception during getLastError.&quot; &amp;lt;&amp;lt; std::endl; }

&lt;p&gt;Without calling getLastError(), the program seems works fine. After adding getLastError() logic, the program works sometimes, but fails some other time, once it fails it continues to fail.&lt;/p&gt;

&lt;p&gt;Following is the output for failed case:&lt;br/&gt;
Caught an unknown exception during getLastError.&lt;br/&gt;
Caught an unknown exception during getLastError.&lt;br/&gt;
Caught an unknown exception during getLastError.&lt;br/&gt;
Caught an unknown exception during getLastError.&lt;br/&gt;
Caught an unknown exception during getLastError.&lt;br/&gt;
Caught an unknown exception during getLastError.&lt;br/&gt;
Caught an unknown exception during getLastError.&lt;br/&gt;
Caught an unknown exception during getLastError.&lt;br/&gt;
Caught an unknown exception during getLastError.&lt;br/&gt;
Caught an unknown exception during getLastError.&lt;br/&gt;
Caught an unknown exception during getLastError.&lt;/p&gt;</description>
                <environment></environment>
        <key id="190559">CXX-564</key>
            <summary>getLastError() fail randomly</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="9">Done</resolution>
                                        <assignee username="adam.midvidy">Adam Midvidy</assignee>
                                    <reporter username="Judy.Han">Judy Han [X]</reporter>
                        <labels>
                            <label>legacy-cxx</label>
                    </labels>
                <created>Thu, 19 Mar 2015 02:46:22 +0000</created>
                <updated>Mon, 23 Mar 2015 23:26:00 +0000</updated>
                            <resolved>Mon, 23 Mar 2015 23:26:00 +0000</resolved>
                                    <version>legacy-1.0.0</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="861655" author="adam.midvidy" created="Mon, 23 Mar 2015 23:25:55 +0000"  >&lt;p&gt;Hi Judy,&lt;/p&gt;

&lt;p&gt;Sure. I will close the ticket as &quot;Gone Away&quot;. Feel free to reopen if you are able to reproduce this again.&lt;/p&gt;

&lt;p&gt;Best,&lt;br/&gt;
Adam&lt;/p&gt;</comment>
                            <comment id="861599" author="judy.han" created="Mon, 23 Mar 2015 22:42:16 +0000"  >&lt;p&gt;Hi Adam,&lt;/p&gt;

&lt;p&gt;Thanks. Since the problem was sporadic, it is not so easy to say it is completely fixed.&lt;br/&gt;
I was able to reproduce the problem only once (the first try after recompile) and the case is a bit different from before - this time I had other errors during the test. But I am not able to reproduce it.&lt;br/&gt;
Maybe we can close this ticket for now and re-open it later if I see that again?&lt;/p&gt;

&lt;p&gt;Thanks!&lt;br/&gt;
Judy&lt;/p&gt;</comment>
                            <comment id="861551" author="adam.midvidy" created="Mon, 23 Mar 2015 21:54:15 +0000"  >&lt;p&gt;Hey Judy, &lt;/p&gt;

&lt;p&gt;Would you mind rerunning your test now that you have the driver compiling with C+&amp;#43;11 mode? There is a possibility that this issue was caused by linking ABI incompatible libstdc+&amp;#43; versions, which can cause strange crashes/bugs.&lt;/p&gt;

&lt;p&gt;Adam&lt;/p&gt;</comment>
                            <comment id="858073" author="judy.han" created="Thu, 19 Mar 2015 17:44:05 +0000"  >&lt;p&gt;Hi Adam,&lt;br/&gt;
    Thanks! yes the Scons invocation used to compile the driver is the same as &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-565&quot; title=&quot; mongo::client::initialize() crashes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-565&quot;&gt;&lt;del&gt;CXX-565&lt;/del&gt;&lt;/a&gt;. The command line options are similar except that we use some extra libraries -lace -lrt -ldl -lxercesc.&lt;br/&gt;
Judy&lt;/p&gt;</comment>
                            <comment id="857652" author="adam.midvidy" created="Thu, 19 Mar 2015 10:36:26 +0000"  >&lt;p&gt;Hi Judy,&lt;/p&gt;

&lt;p&gt;Thanks for the report. I will try to reproduce this issue today. &lt;/p&gt;

&lt;p&gt;Can I have the exact SCons invocation used to compile the driver, as well as the compiler flags used to build your application? If they are the same as in &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-565&quot; title=&quot; mongo::client::initialize() crashes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-565&quot;&gt;&lt;del&gt;CXX-565&lt;/del&gt;&lt;/a&gt;, you can just indicate that as well.&lt;/p&gt;

&lt;p&gt;Adam&lt;/p&gt;</comment>
                            <comment id="857530" author="judy.han" created="Thu, 19 Mar 2015 02:54:29 +0000"  >&lt;p&gt;fixing some typo, add line number for easier reference for the code snippet:&lt;br/&gt;
  1 static _thread mongo::DBClientConnection *mongoPtr;&lt;br/&gt;
  2 ...&lt;br/&gt;
  3 bool event_loader::threadSpecificInit()&lt;br/&gt;
  4 &lt;/p&gt;
{ //each thread call this once at thread startup mongoPtr_ = new mongo::DBClientConnection(); ...}
&lt;p&gt;  5 &lt;br/&gt;
  6 void event_loader::handleInput() {&lt;br/&gt;
  7 //each thread run this in a loop&lt;br/&gt;
  8 try {&lt;br/&gt;
  9 //build bulk_data&lt;br/&gt;
 10 ......&lt;br/&gt;
 11 mongoPtr_-&amp;gt;insert(&quot;event_test.collection1&quot;, bulk_data);&lt;br/&gt;
 12 try {&lt;br/&gt;
 13 if (!(mongoPtr_-&amp;gt;getLastError()).empty())&lt;br/&gt;
 14 &lt;/p&gt;
{ std::cout &amp;lt;&amp;lt; &quot;insert failed&quot; &amp;lt;&amp;lt; std::endl; }
&lt;p&gt; 15 }&lt;br/&gt;
 16 catch (const MtxUtil::Exception&amp;amp; exc)&lt;br/&gt;
 17 &lt;/p&gt;
{ std::cout &amp;lt;&amp;lt; &quot;Caught an exception during getLastError.\n&quot; &amp;lt;&amp;lt; &quot;Exception&apos;s what()=&quot; &amp;lt;&amp;lt; exc.what() &amp;lt;    &amp;lt; std::endl; }
&lt;p&gt; 18 &lt;br/&gt;
 19 catch (...) &lt;br/&gt;
 20 &lt;/p&gt;
{ std::cout &amp;lt;&amp;lt; &quot;Caught an unknown exception during getLastError.&quot; &amp;lt;&amp;lt; std::endl; }
&lt;p&gt; &lt;br/&gt;
 21 ...&lt;br/&gt;
 22 }&lt;br/&gt;
 23 catch (const MtxUtil::Exception&amp;amp; exc)&lt;br/&gt;
 24 ...&lt;br/&gt;
 25 }&lt;br/&gt;
~&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|hs79dr:</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>