<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:00:00 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-3608] updateOne blocked due to ?retryWriter=true and WriteConcern.UNACKNOWLEDGED combination</title>
                <link>https://jira.mongodb.org/browse/JAVA-3608</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;There is a very specific combination of factors that must be fulfilled for this to happen:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;tt&gt;Use mongodb-driver-sync 3.12.0 or 3.12.1&lt;/tt&gt;&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;Connect with ?retryWrites=true&lt;/tt&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;ol&gt;
	&lt;li&gt;Do a write to a document with&#160;WriteConcern.UNACKNOWLEDGED. Driver will log that retryWrites=true cannot be used by unacknowledged.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;e.g.&#160;&lt;/p&gt;

&lt;p&gt;userColl.withWriteConcern(WriteConcern.UNACKNOWLEDGED).updateMany(in(&quot;_id&quot;, ids), inc(&quot;impressionCount&quot;, 1));&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;db.user.updateMany({_id: &lt;span class=&quot;error&quot;&gt;&amp;#91;466&amp;#93;&lt;/span&gt;}, {$inc: {impressionCount: 1&lt;/tt&gt;, {w: 0});}}&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;Do another update with Java for the same document, this time with writeConcern of 1.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;db.user.updateOne( {_id: 466}, { $set: { &apos;email&apos;: &apos;&lt;span class=&quot;nobr&quot;&gt;&lt;a href=&quot;mailto:hendy@hendyirawan.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;hendy@hendyirawan.com&lt;sup&gt;&lt;img class=&quot;rendericon&quot; src=&quot;https://jira.mongodb.org/images/icons/mail_small.gif&quot; height=&quot;12&quot; width=&quot;13&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;&apos;}}, {w: 1});&lt;/p&gt;



&lt;ol&gt;
	&lt;li&gt;At this point the previous updateOne() is locked and will never return.&lt;/li&gt;
	&lt;li&gt;Also, pressing Ctrl+C does not terminate the app. Java app cannot exit. Doing a kill -9 will make connections stuck on the MongoDB server (at least on MongoDB Atlas M10 v4.2.2 it does).&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Note that this bug is not reproducible when using mongo shell, so I think this bug is specific to MongoDB Java Driver. At first I thought it is due to codecs or thread safety or server busy, but even just updating a string reproduces the issue.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Workaround:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Don&apos;t use WriteConcern.UNACKNOWLEDGED (with ?retryWrites=true).&#160; As long as I update always with w=1 or w=majority, there is no issue.&lt;/p&gt;</description>
                <environment>Java 8, MongoDB Atlas M5 4.2.2</environment>
        <key id="1116531">JAVA-3608</key>
            <summary>updateOne blocked due to ?retryWriter=true and WriteConcern.UNACKNOWLEDGED combination</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="john.stewart@mongodb.com">John Stewart</assignee>
                                    <reporter username="hendy@hendyirawan.com">Hendy Irawan</reporter>
                        <labels>
                    </labels>
                <created>Mon, 27 Jan 2020 15:14:34 +0000</created>
                <updated>Tue, 25 Feb 2020 14:26:54 +0000</updated>
                            <resolved>Tue, 25 Feb 2020 14:26:54 +0000</resolved>
                                    <version>3.12.1</version>
                                                    <component>Write Operations</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="2907217" author="john.stewart" created="Tue, 25 Feb 2020 14:26:09 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=hendy%40hendyirawan.com&quot; class=&quot;user-hover&quot; rel=&quot;hendy@hendyirawan.com&quot;&gt;hendy@hendyirawan.com&lt;/a&gt; The cloud team was able to identify the cause of the issue and they have opened the ticket CLOUDP-58004 to work on this. You can follow that ticket for further updates. If that ticket fails to resolve this issue, I will reopen this bug.&lt;/p&gt;</comment>
                            <comment id="2862283" author="hendy@hendyirawan.com" created="Tue, 11 Feb 2020 05:58:50 +0000"  >&lt;p&gt;Thank you John !&lt;/p&gt;</comment>
                            <comment id="2861467" author="john.stewart" created="Tue, 11 Feb 2020 02:51:39 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=hendy%40hendyirawan.com&quot; class=&quot;user-hover&quot; rel=&quot;hendy@hendyirawan.com&quot;&gt;hendy@hendyirawan.com&lt;/a&gt; I was able to reproduce the hang in the mongo shell with an M5 instance. After executing the update with &lt;tt&gt;w=0&lt;/tt&gt;, I get the response &lt;tt&gt;acknowledged: false&lt;/tt&gt; and then a hang:&lt;br/&gt;
&#160;&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;MongoDB Enterprise Sandbox-shard-0:PRIMARY&amp;gt; db.restaurants.updateOne({_id: 666}, {$set: {&apos;cuisine&apos;: &apos;Italian&apos;}}, {w: 0})&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;   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;{ &quot;acknowledged&quot; : false }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;&#160;I am then unable to execute any other commands. Entering Ctrl-C generates an exception and dumps a backtrace. I am using the mongo shell version 4.2.2. &lt;/p&gt;</comment>
                            <comment id="2859981" author="hendy@hendyirawan.com" created="Mon, 10 Feb 2020 22:21:25 +0000"  >&lt;p&gt;Thank you very much @John ! And that is good news... I hope you&apos;ll find the root cause soon &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;</comment>
                            <comment id="2857988" author="john.stewart" created="Mon, 10 Feb 2020 17:59:00 +0000"  >&lt;p&gt;I am able to replicate this issue only with an M5 instance. I am investigating further.&lt;/p&gt;</comment>
                            <comment id="2781620" author="hendy@hendyirawan.com" created="Tue, 4 Feb 2020 00:33:27 +0000"  >&lt;p&gt;Did you get the driver complaining &quot;Driver will log that retryWrites=true cannot be used with unacknowledged.&quot;?&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;So far the difference is:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;I used Atlas shared M5 instance (my gut feeling is this may have an effect)&lt;/li&gt;
	&lt;li&gt;my connection string has w=1 and uses SRV&#160;&lt;/li&gt;
&lt;/ol&gt;
</comment>
                            <comment id="2780493" author="john.stewart" created="Mon, 3 Feb 2020 16:51:46 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=hendy%40hendyirawan.com&quot; class=&quot;user-hover&quot; rel=&quot;hendy@hendyirawan.com&quot;&gt;hendy@hendyirawan.com&lt;/a&gt; I created a test based on your description and ran it successfully against a 4.2.2 replica set. Since &lt;tt&gt;retryWrites=true&lt;/tt&gt; is the default, I ran the test with and without &lt;tt&gt;?retryWrites=true&lt;/tt&gt; in the connection string, but I could not reproduce your issue. Here is my test:&lt;/p&gt;

&lt;p&gt;&#160;&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;MongoClient mongoClient = MongoClients.create(&quot;mongodb://localhost:27017,localhost:27018,localhost:27019/?retryWrites=true&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;MongoDatabase db = mongoClient.getDatabase(&quot;test&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;db.getCollection(&quot;restaurants&quot;).deleteOne(eq(&quot;_id&quot;, 666));&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;db.getCollection(&quot;restaurants&quot;).insertOne(new Document(&quot;_id&quot;, new BsonInt32(666))&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; .append(&quot;cuisine&quot;, &quot;something&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;db.getCollection(&quot;restaurants&quot;).withWriteConcern(WriteConcern.UNACKNOWLEDGED)&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; .updateMany(new Document(&quot;_id&quot;, new BsonInt32(666)),&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;   new Document(&quot;$set&quot;, new Document(&quot;cuisine&quot;, &quot;Category To Be Determined&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;db.getCollection(&quot;restaurants&quot;).withWriteConcern(WriteConcern.W1)&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; .updateOne(new Document(&quot;_id&quot;, new BsonInt32(666)),&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;   new Document(&quot;$currentDate&quot;, new Document(&quot;lastModified&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;   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;mongoClient.close();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;Could you point out the differences between my test and your scenario? Thanks.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1161392">CSHARP-2970</issuekey>
        </issuelink>
                            </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|hw9hgn:</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>