<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:00:55 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-3973] Regression in reactive streams implementation memory consumption</title>
                <link>https://jira.mongodb.org/browse/JAVA-3973</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;An upgrade from mongo-java-driver (and mongo-java-driver) from 4.1.1 to 4.2.0 lead to increased memory consumption and decreased performance. (Jobs taking massively longer than before)&lt;/p&gt;

&lt;p&gt;We solved the issues by rolling back to 4.1.1.&lt;/p&gt;

&lt;p&gt;We don&apos;t have minimal reproducing examples but it is very visible for usecases where we stream a huge amount of documents reading from the database using reactive streams.&lt;/p&gt;

&lt;p&gt;The changelog states that you exchanged the internal reactive-streams implementation so maybe it has something to do with this.&lt;/p&gt;</description>
                <environment>linux, OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode), atlas</environment>
        <key id="1603168">JAVA-3973</key>
            <summary>Regression in reactive streams implementation memory consumption</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="13201">Fixed</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="frederick.roth@breuninger.de">Fred Roth</reporter>
                        <labels>
                    </labels>
                <created>Thu, 28 Jan 2021 09:23:26 +0000</created>
                <updated>Sat, 28 Oct 2023 11:21:27 +0000</updated>
                            <resolved>Thu, 11 Feb 2021 13:27:00 +0000</resolved>
                                    <version>4.2.0</version>
                                    <fixVersion>4.2.1</fixVersion>
                                    <component>Reactive Streams</component>
                    <component>Scala</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="3702100" author="xgen-internal-githook" created="Mon, 5 Apr 2021 23:42:22 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Valentin Kovalenko&apos;, &apos;email&apos;: &apos;valentin.kovalenko@mongodb.com&apos;, &apos;username&apos;: &apos;stIncMale&apos;}
&lt;p&gt;Message: Backport to 4.2.x &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4044&quot; title=&quot;Exception when dropping a collection with changestream&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-4044&quot;&gt;&lt;del&gt;JAVA-4044&lt;/del&gt;&lt;/a&gt;/PR#689 and the changes it depends on (&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3938&quot; title=&quot;Change stream connections not returned&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3938&quot;&gt;&lt;del&gt;JAVA-3938&lt;/del&gt;&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3907&quot; title=&quot;AsyncQueryBatchCursor does not release ConnectionSource when closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3907&quot;&gt;&lt;del&gt;JAVA-3907&lt;/del&gt;&lt;/a&gt; / PR#661) (#691)&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Regression test for change stream cancellation (#661)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Ensures that all sessions are returned to the pool&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3938&quot; title=&quot;Change stream connections not returned&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3938&quot;&gt;&lt;del&gt;JAVA-3938&lt;/del&gt;&lt;/a&gt; &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3907&quot; title=&quot;AsyncQueryBatchCursor does not release ConnectionSource when closed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3907&quot;&gt;&lt;del&gt;JAVA-3907&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Guarantee that ChangeStreamPublisher for a collection completes after dropping the collection (#689)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Before the changes made within &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3973&quot; title=&quot;Regression in reactive streams implementation memory consumption&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3973&quot;&gt;&lt;del&gt;JAVA-3973&lt;/del&gt;&lt;/a&gt;,&lt;br/&gt;
ChangeStreamPublisher had been terminating with onError.&lt;br/&gt;
After the changes in &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3973&quot; title=&quot;Regression in reactive streams implementation memory consumption&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3973&quot;&gt;&lt;del&gt;JAVA-3973&lt;/del&gt;&lt;/a&gt; neither onError nor onComplete is called,&lt;br/&gt;
but those changes allow us to terminated it with onComplete.&lt;br/&gt;
I could have specified only assertTerminalEvent()&lt;br/&gt;
without specifying assertNoErrors(), thus accepting either onComplete or onError&lt;br/&gt;
(the old behavior), but terminating with onComplete is nicer.&lt;/p&gt;

&lt;p&gt;The approach with using startAtOperationTime to ensure that&lt;br/&gt;
a change stream is guaranteed to observe collection.drop()&lt;br/&gt;
works only if there is no leader re-election that results in&lt;br/&gt;
rolling back the delete operation from which the operationTime&lt;br/&gt;
was extracted. While such rollback can be prevented by using&lt;br/&gt;
the &quot;majority&quot; write concern, the common approach in driver tests&lt;br/&gt;
is to not use it for efficiency and tolerate a tiny chance of&lt;br/&gt;
experiencing a rollback.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4044&quot; title=&quot;Exception when dropping a collection with changestream&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-4044&quot;&gt;&lt;del&gt;JAVA-4044&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Co-authored-by: Ross Lawley &amp;lt;ross.lawley@gmail.com&amp;gt;&lt;br/&gt;
Branch: 4.2.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/77c8795eec482f909cfb658b46771b51c2ded7e0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/77c8795eec482f909cfb658b46771b51c2ded7e0&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3682132" author="xgen-internal-githook" created="Wed, 24 Mar 2021 18:17:54 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Valentin Kovalenko&apos;, &apos;email&apos;: &apos;valentin.kovalenko@mongodb.com&apos;, &apos;username&apos;: &apos;stIncMale&apos;}
&lt;p&gt;Message: Guarantee that ChangeStreamPublisher for a collection completes after dropping the collection (#689)&lt;/p&gt;

&lt;p&gt;Before the changes made within &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3973&quot; title=&quot;Regression in reactive streams implementation memory consumption&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3973&quot;&gt;&lt;del&gt;JAVA-3973&lt;/del&gt;&lt;/a&gt;,&lt;br/&gt;
ChangeStreamPublisher had been terminating with onError.&lt;br/&gt;
After the changes in &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3973&quot; title=&quot;Regression in reactive streams implementation memory consumption&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3973&quot;&gt;&lt;del&gt;JAVA-3973&lt;/del&gt;&lt;/a&gt; neither onError nor onComplete is called,&lt;br/&gt;
but those changes allow us to terminated it with onComplete.&lt;br/&gt;
I could have specified only assertTerminalEvent()&lt;br/&gt;
without specifying assertNoErrors(), thus accepting either onComplete or onError&lt;br/&gt;
(the old behavior), but terminating with onComplete is nicer.&lt;/p&gt;

&lt;p&gt;The approach with using startAtOperationTime to ensure that&lt;br/&gt;
a change stream is guaranteed to observe collection.drop()&lt;br/&gt;
works only if there is no leader re-election that results in&lt;br/&gt;
rolling back the delete operation from which the operationTime&lt;br/&gt;
was extracted. While such rollback can be prevented by using&lt;br/&gt;
the &quot;majority&quot; write concern, the common approach in driver tests&lt;br/&gt;
is to not use it for efficiency and tolerate a tiny chance of&lt;br/&gt;
experiencing a rollback.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4044&quot; title=&quot;Exception when dropping a collection with changestream&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-4044&quot;&gt;&lt;del&gt;JAVA-4044&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/b3698be5d218af6c3ee94aca2a5cccbf7a853e3a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/b3698be5d218af6c3ee94aca2a5cccbf7a853e3a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3616811" author="jeff.yemin" created="Tue, 16 Feb 2021 13:31:58 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=joao%40nezasa.com&quot; class=&quot;user-hover&quot; rel=&quot;joao@nezasa.com&quot;&gt;joao@nezasa.com&lt;/a&gt; by the end of this week.&lt;/p&gt;</comment>
                            <comment id="3612237" author="JIRAUSER1253777" created="Thu, 11 Feb 2021 18:34:11 +0000"  >&lt;p&gt;Also fixes our problem. Any ETA for 4.2.1?&lt;/p&gt;</comment>
                            <comment id="3611391" author="ross@10gen.com" created="Thu, 11 Feb 2021 13:27:00 +0000"  >&lt;p&gt;Thanks &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=frederick.roth%40breuninger.de&quot; class=&quot;user-hover&quot; rel=&quot;frederick.roth@breuninger.de&quot;&gt;frederick.roth@breuninger.de&lt;/a&gt; for testing.&lt;/p&gt;</comment>
                            <comment id="3611380" author="frederick.roth@breuninger.de" created="Thu, 11 Feb 2021 13:12:38 +0000"  >&lt;p&gt;Hi Ross,&lt;/p&gt;

&lt;p&gt;I just ran our workload with 4.1.1, 4.2.0, and 4.2.1-SNAPSHOT. The performance and memory footprint of the new 4.2.1-SNAPSHOT version is very similar to 4.1.1. And therefore way better than 4.2.0.&lt;/p&gt;

&lt;p&gt;So from my point of view it seems to be fixed.&lt;/p&gt;

&lt;p&gt;Thanks for your effort &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;Fred&lt;/p&gt;</comment>
                            <comment id="3611333" author="ross@10gen.com" created="Thu, 11 Feb 2021 12:21:31 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=frederick.roth%40breuninger.de&quot; class=&quot;user-hover&quot; rel=&quot;frederick.roth@breuninger.de&quot;&gt;frederick.roth@breuninger.de&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jtjeferreira%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;jtjeferreira@gmail.com&quot;&gt;jtjeferreira@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Just to let you know that the &lt;a href=&quot;https://oss.sonatype.org/content/repositories/snapshots/org/mongodb/mongodb-driver-reactivestreams/4.2.1-SNAPSHOT/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;4.2.1-SNAPSHOT&lt;/a&gt; has been released with an improvement in the  BatchCursorPublisher.&lt;/p&gt;

&lt;p&gt;If possible it would be great if you could test this fix and provide feedback before the release.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="3597317" author="xgen-internal-githook" created="Wed, 3 Feb 2021 17:13:55 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Ross Lawley&apos;, &apos;email&apos;: &apos;ross.lawley@gmail.com&apos;, &apos;username&apos;: &apos;rozza&apos;}
&lt;p&gt;Message: Fix reactive streams batch cursor regression. (#652)&lt;/p&gt;

&lt;p&gt;The BatchCursorPublisher now waits for demand to be signalled before&lt;br/&gt;
creating the cursor.&lt;/p&gt;

&lt;p&gt;The batch cursor publisher also internally respects the batch size.&lt;br/&gt;
Its either the configured batch size if set or the amount requested.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3973&quot; title=&quot;Regression in reactive streams implementation memory consumption&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3973&quot;&gt;&lt;del&gt;JAVA-3973&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/4af9e9f2a541b8a89eadd7f91124b324015866eb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/4af9e9f2a541b8a89eadd7f91124b324015866eb&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3594734" author="ross@10gen.com" created="Tue, 2 Feb 2021 15:27:16 +0000"  >&lt;p&gt;HI &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jtjeferreira%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;jtjeferreira@gmail.com&quot;&gt;jtjeferreira@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;That&apos;s great, internally we still use the BufferAsyncSink however, we have identified a change in how demand is signalled and processed, which can lead to excessive buffering.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="3594363" author="jtjeferreira@gmail.com" created="Tue, 2 Feb 2021 12:27:45 +0000"  >&lt;p&gt;Hi&lt;/p&gt;

&lt;p&gt;We also see something similar when upgrading to 4.2. Rolling back to 4.1.1 seems to fix it. I dont have a minimal reproducer, but I have a an heapdump which I can share some screenshots:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Overview&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://jira.mongodb.org/secure/attachment/298166/298166_image-2021-02-02-12-26-11-680.png&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;List object with outgoing references&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://jira.mongodb.org/secure/attachment/298167/298167_image-2021-02-02-12-27-01-888.png&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;</comment>
                            <comment id="3589374" author="ross@10gen.com" created="Fri, 29 Jan 2021 13:57:25 +0000"  >&lt;p&gt;PR: &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/pull/652/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/pull/652/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3586868" author="ross@10gen.com" created="Thu, 28 Jan 2021 11:47:09 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=frederick.roth%40breuninger.de&quot; class=&quot;user-hover&quot; rel=&quot;frederick.roth@breuninger.de&quot;&gt;frederick.roth@breuninger.de&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;No problems, I inferred that you were using Scala but as the main change has been the introduction of Project Reactor I&apos;ll base my investigations there to begin with.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="3586792" author="frederick.roth@breuninger.de" created="Thu, 28 Jan 2021 10:44:49 +0000"  >&lt;p&gt;My colleague spotted a typo in my description: I wanted to write &quot;mongo-java-driver (mongo-scala-driver)&quot; meaning: we use the scala driver using the underlying reactive streams java driver.&lt;/p&gt;</comment>
                            <comment id="3586759" author="ross@10gen.com" created="Thu, 28 Jan 2021 10:12:44 +0000"  >&lt;p&gt;Firstly, thanks for the report &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=frederick.roth%40breuninger.de&quot; class=&quot;user-hover&quot; rel=&quot;frederick.roth@breuninger.de&quot;&gt;frederick.roth@breuninger.de&lt;/a&gt; and bring this to our attention. Secondly, apologies for causing a performance regression.&lt;/p&gt;

&lt;p&gt;We&apos;ll investigate and will report back.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10520">
                    <name>Problem/Incident</name>
                                            <outwardlinks description="causes">
                                        <issuelink>
            <issuekey id="1647998">JAVA-4044</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="298166" name="image-2021-02-02-12-26-11-680.png" size="34372" author="jtjeferreira@gmail.com" created="Tue, 2 Feb 2021 12:25:23 +0000"/>
                            <attachment id="298167" name="image-2021-02-02-12-27-01-888.png" size="231718" author="jtjeferreira@gmail.com" created="Tue, 2 Feb 2021 12:26:14 +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|hyddm7:</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>