<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:38 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>[JAVA-591] Long-running tailable cursors consume too much memory</title>
                <link>https://jira.mongodb.org/browse/JAVA-591</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I already posted it on the mailing list, it didn&apos;t receive any replies, but I still think it&apos;s a bug. Please correct me if I&apos;m wrong.&lt;/p&gt;

&lt;p&gt;A tailable cursor on a capped collection can live potentially for a long time and return multiple batches of data.&lt;br/&gt;
However, it seems to me that the size of each batch that is read from Mongo is added to the list: DBApiLayer.Result._sizes, in the DBApiLayer.Result.init method, called from the _advance method.&lt;/p&gt;

&lt;p&gt;The list is available via DBCursor.getSizes().&lt;/p&gt;

&lt;p&gt;If the list grows and grows, especially if there&apos;s a lot of data added to the capped collection, eventually it will OOM.&lt;/p&gt;

&lt;p&gt;Is that right?&lt;/p&gt;

&lt;p&gt;UPDATE:&lt;/p&gt;

&lt;p&gt;Added DBCursor.disableBatchSizeTracking() to work around this problem.&lt;/p&gt;</description>
                <environment></environment>
        <key id="42832">JAVA-591</key>
            <summary>Long-running tailable cursors consume too much memory</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="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="adamw1pl">Adam Warski</reporter>
                        <labels>
                    </labels>
                <created>Fri, 29 Jun 2012 10:43:39 +0000</created>
                <updated>Thu, 29 Jan 2015 14:33:20 +0000</updated>
                            <resolved>Mon, 27 Oct 2014 20:12:53 +0000</resolved>
                                    <version>2.7.2</version>
                                    <fixVersion>2.13.0</fixVersion>
                                    <component>Query Operations</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="816419" author="jeff.yemin" created="Thu, 29 Jan 2015 14:33:20 +0000"  >&lt;p&gt;2.13.0 has been released.  Closing issue.&lt;/p&gt;</comment>
                            <comment id="749696" author="xgen-internal-githook" created="Mon, 27 Oct 2014 20:12:47 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: Added a way to disable batch size tracking on DBCursor in order to avoid the list which tracks each batch size from growing&lt;br/&gt;
indefinitely (a problem mostly for high-volume tailable cursors).&lt;/p&gt;

&lt;p&gt;  &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-591&quot; title=&quot;Long-running tailable cursors consume too much memory&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-591&quot;&gt;&lt;del&gt;JAVA-591&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/c1e298005c0319a92d2e61ec874ae1c2ee8a73c7&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/c1e298005c0319a92d2e61ec874ae1c2ee8a73c7&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="138651" author="adamw1pl" created="Mon, 2 Jul 2012 16:01:07 +0000"  >&lt;p&gt;No, I&apos;m not seeing this problem in practice yet, though the possibility is disturbing, especially that tailing cursors may live for a very long time, right? (I&apos;m not an expert on mongo so I might be missing something here).&lt;/p&gt;

&lt;p&gt;I think using a list which holds last N batch sizes would be best.&lt;/p&gt;</comment>
                            <comment id="138601" author="jeff.yemin" created="Mon, 2 Jul 2012 14:33:06 +0000"  >&lt;p&gt;Are you seeing this problem in practice?  It would take a lot of batches before you get to any significant size array.&lt;/p&gt;

&lt;p&gt;Couple of options I can see:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Add a clearSizes method to DBCursor so that you can control the size of the list.&lt;/li&gt;
	&lt;li&gt;Change the contract of getSizes so that it returns the last N batch sizes, instead of infinitely growing.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="137876" author="adamw1pl" created="Fri, 29 Jun 2012 10:44:00 +0000"  >&lt;p&gt;The forum entry is:&lt;br/&gt;
&lt;a href=&quot;https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/bE6j_u45y2w&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/bE6j_u45y2w&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                        </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|hs343b:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>142969</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="321">Java Sprint 10</customfieldvalue>

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