<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:09:21 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-395] Need clarification on mongo c-driver</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-395</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;Hi,&lt;br/&gt;
 I am using libmongoc.so.0.7.0 with tail functionality to read from mongodb.&lt;br/&gt;
Valgrind shows leak in this as follows.&lt;/p&gt;

&lt;p&gt;------------------------------------------------------------------------------------------------&lt;br/&gt;
==00:00:08:55.814 17673== 151,848 (123,120 direct, 28,728 indirect) bytes in 513 blocks are definitely lost in loss record 270 of 272&lt;br/&gt;
==00:00:08:55.815 17673==    at 0x4C229FE: malloc (vg_replace_malloc.c:291)&lt;br/&gt;
==00:00:08:55.815 17673==    by 0x4E3104C: bson_malloc (bson.c:952)&lt;br/&gt;
==00:00:08:55.815 17673==    by 0x4E3735F: mongo_find (mongo.c:1243)&lt;br/&gt;
==00:00:08:55.815 17673==    by 0x40482A: start_threshold_mongo_log_tailable (mongotosqlite_main.c:481)&lt;br/&gt;
==00:00:08:55.815 17673==    by 0x619AFC6: start_thread (in /lib64/libpthread-2.8.so)&lt;br/&gt;
==00:00:08:55.815 17673==    by 0x6A097AC: clone (in /lib64/libc-2.8.so)&lt;br/&gt;
==00:00:08:55.815 17673==&lt;br/&gt;
==00:00:08:55.815 17673== 745,644 (599,280 direct, 146,364 indirect) bytes in 2,497 blocks are definitely lost in loss record 271 of 272&lt;br/&gt;
==00:00:08:55.815 17673==    at 0x4C229FE: malloc (vg_replace_malloc.c:291)&lt;br/&gt;
==00:00:08:55.815 17673==    by 0x4E3104C: bson_malloc (bson.c:952)&lt;br/&gt;
==00:00:08:55.815 17673==    by 0x4E3735F: mongo_find (mongo.c:1243)&lt;br/&gt;
==00:00:08:55.815 17673==    by 0x4050A8: start_mongo_log_tailable (mongotosqlite_main.c:724)&lt;br/&gt;
==00:00:08:55.815 17673==    by 0x619AFC6: start_thread (in /lib64/libpthread-2.8.so)&lt;br/&gt;
==00:00:08:55.815 17673==    by 0x6A097AC: clone (in /lib64/libc-2.8.so)&lt;br/&gt;
==00:00:08:55.815 17673==&lt;br/&gt;
----------------------------------------------------------------------------------------------&lt;/p&gt;

&lt;p&gt;code snippet.&lt;br/&gt;
-------------------&lt;br/&gt;
while(1)&lt;br/&gt;
{&lt;br/&gt;
if(mongo_check_connection (&amp;amp;client_apslog) == MONGO_ERROR )&lt;br/&gt;
    {&lt;br/&gt;
        mongo_destroy (&amp;amp;client_apslog);&lt;br/&gt;
        if (mongo_client (&amp;amp;client_apslog, &quot;127.0.0.1&quot;, 27017) != MONGO_OK)&lt;/p&gt;
       {
         syslog(LOG_LOCAL0, &quot; Failed to connect to mongo for Thrshold trhead Err:%s&quot;,client_apslog.errstr);
      }
&lt;p&gt;    }&lt;br/&gt;
    cursor = mongo_find( &amp;amp;client_apslog,table_name , &amp;amp;b, bson_empty( &amp;amp;e ), 0, 0, MONGO_TAILABLE);&lt;br/&gt;
    if(cursor != NULL)&lt;br/&gt;
    {&lt;br/&gt;
       while(mongo_cursor_next( cursor ) == MONGO_OK)&lt;br/&gt;
       &lt;/p&gt;
{
         bson *curr_doc = mongo_cursor_bson(cursor);
        .....
       }
&lt;p&gt; // end of while(mongo_cursor_next&lt;/p&gt;

&lt;p&gt;       bson_destroy( &amp;amp;b );&lt;br/&gt;
    bson_init( &amp;amp;b );&lt;br/&gt;
    bson_append_start_object( &amp;amp;b, &quot;_id&quot; );&lt;br/&gt;
    bson_append_oid( &amp;amp;b, &quot;$gt&quot;, &amp;amp;id );&lt;br/&gt;
    bson_append_finish_object( &amp;amp;b );&lt;br/&gt;
    bson_finish( &amp;amp;b );&lt;br/&gt;
 }//end of cursor != NULL&lt;br/&gt;
}&lt;br/&gt;
Can you please advise what is wrong.&lt;br/&gt;
 I do call bson_destroy(&amp;amp;)  at end of while(mongo_cursor_next( cursor ) == MONGO_OK)&lt;/p&gt;</description>
                <environment>linux&lt;br/&gt;
&lt;br/&gt;
*Location*: &lt;a href=&quot;http://www.mongodb.org/about/support/&quot;&gt;http://www.mongodb.org/about/support/&lt;/a&gt;&lt;br/&gt;
*User-Agent*: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11&lt;br/&gt;
*Referrer*: &lt;a href=&quot;http://www.mongodb.org/&quot;&gt;http://www.mongodb.org/&lt;/a&gt;&lt;br/&gt;
*Screen Resolution*: 1360 x 768&lt;br/&gt;
*repo*: mongodb-www-about&lt;br/&gt;
*source*: support&lt;br/&gt;
</environment>
        <key id="147185">CDRIVER-395</key>
            <summary>Need clarification on mongo c-driver</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                                <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="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="asethy">Arati Sethy</reporter>
                        <labels>
                            <label>collector-298ba4e7</label>
                    </labels>
                <created>Tue, 15 Jul 2014 11:24:04 +0000</created>
                <updated>Wed, 3 May 2017 22:15:04 +0000</updated>
                            <resolved>Wed, 16 Jul 2014 19:11:40 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="660982" author="christian.hergert@10gen.com" created="Wed, 16 Jul 2014 19:15:49 +0000"  >&lt;p&gt;Sorry for the short non-answers above, just cleaning up things before release.&lt;/p&gt;

&lt;p&gt;Short answer is, it probably does leak in this situation. The legacy driver didn&apos;t really have support for tailable cursors, so it is completely untested. I strongly suggest updating your code to use the new driver. It will be faster, safer, and is to the best of our knowledge, leak free.&lt;/p&gt;</comment>
                            <comment id="660977" author="christian.hergert@10gen.com" created="Wed, 16 Jul 2014 19:11:40 +0000"  >&lt;p&gt;Marking wont fix as the legacy driver is no longer supported.&lt;/p&gt;</comment>
                            <comment id="660976" author="christian.hergert@10gen.com" created="Wed, 16 Jul 2014 19:10:48 +0000"  >&lt;p&gt;Hi, this code is using the legacy driver which is no longer supported. The current version of a C driver has a new API, but also has rigorous valgrind testing.&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|hs0i7r:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>127380</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>