<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:43:58 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>[CSHARP-2960] Unacknowledged writes fail silently when retryWrites=true</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2960</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;div class=&quot;panel&quot; style=&quot;background-color: #eeeeee;border-color: #cccccc;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-color: #cccccc;background-color: #6cb33f;&quot;&gt;&lt;b&gt;Issue Status as of Feb 12, 2020&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;panelContent&quot; style=&quot;background-color: #eeeeee;&quot;&gt;
&lt;p&gt;&lt;b&gt;ISSUE DESCRIPTION AND IMPACT&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;This issue affects MongoDB C# driver versions 2.10.0 and 2.10.1.&lt;/p&gt;

&lt;p&gt;To be impacted by this bug you must be:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Using the MongoDB C# Driver version 2.10.0 or 2.10.1, or another library that has imported either of these driver releases.&lt;/li&gt;
	&lt;li&gt;Using the default driver behavior for retryable writes, which is &quot;retryableWrites=true&quot;.&lt;/li&gt;
	&lt;li&gt;Overriding default driver behavior by issuing writes with the Unacknowledged write concern (&lt;tt&gt;WriteConcern.Unacknowledged&lt;/tt&gt;, also known as {&lt;tt&gt;w:0&lt;/tt&gt;}).&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Writes issued in these circumstances incorrectly include a transaction number without a session ID. This causes the server to reject the writes and, because of the specified Unacknowledged write concern, the client is not notified.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;WORKAROUNDS AND REMEDIATION AND FIX VERSIONS&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;You can work around this bug in one of two ways:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Avoid unacknowledged writes ((&lt;tt&gt;WriteConcern.Unacknowledged&lt;/tt&gt;). Importantly, Unacknowledged is not a recommended WriteConcern setting and should only be used in situations where silently failing writes are acceptable.&lt;/li&gt;
	&lt;li&gt;Disable Retryable Writes by specifying &quot;retryWrites=false&quot; in the connection string provided to the driver. This is a less desirable workaround due to the benefits of retryable writes.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Unfortunately, it is not possible to identify or determine what writes have been lost unless the application has sufficient logging to provide this information.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;FIX VERSIONS&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;A fix for this issue will be included in C# Driver version 2.10.2. All users that use Unacknowledged Writes (&lt;tt&gt;WriteConcern.Unacknowledged&lt;/tt&gt;) are encouraged to upgrade immediately.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;h6&gt;&lt;a name=&quot;OriginalDescription&quot;&gt;&lt;/a&gt;Original Description&lt;/h6&gt;

&lt;p&gt;Starting in the c# driver version 2.10.0 with MongoDB 4.2, if we try to insert a document using the WriteConcern Unacknowledged, the document never gets inserted into the collection.&#160;&#160;&lt;/p&gt;

&lt;p&gt;Note: the exact code with version 2.9.3 works without issue.&#160;&lt;/p&gt;

&lt;p&gt;Sample code that does not work (no issues on the client but the data never gets to Mongo):&lt;/p&gt;

&lt;p&gt;Public async Task Insert(DataModel model)&lt;/p&gt;

{
&#160; &#160;IMongoDatabase db = code to get database removed;
&#160; &#160;var coll = db.GetCollection&amp;lt;DataModel&amp;gt;(&quot;CollName&quot;);
&#160; &#160;await coll.WithWriteConcern(WriteConcern.Unacknowledged).InsertOneAsync(model);

}

&lt;p&gt;Sample code that works (can use any write concern but Unacknowledged):&lt;/p&gt;

&lt;p&gt;Public async Task Insert(DataModel model)&lt;/p&gt;

{
&#160; &#160;IMongoDatabase db = code to get database removed;
&#160; &#160;var coll = db.GetCollection&amp;lt;DataModel&amp;gt;(&quot;CollName&quot;);
&#160; &#160;await coll.WithWriteConcern(WriteConcern.Acknowledged).InsertOneAsync(model);

}</description>
                <environment>MongoDB 4.2</environment>
        <key id="1141648">CSHARP-2960</key>
            <summary>Unacknowledged writes fail silently when retryWrites=true</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="pgordon@truckdown.com">Peter Gordon</reporter>
                        <labels>
                    </labels>
                <created>Mon, 10 Feb 2020 14:38:22 +0000</created>
                <updated>Sat, 28 Oct 2023 11:48:23 +0000</updated>
                            <resolved>Wed, 12 Feb 2020 21:04:21 +0000</resolved>
                                    <version>2.10.0</version>
                                    <fixVersion>2.10.2</fixVersion>
                                    <component>Write Operations</component>
                                        <votes>0</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="2874986" author="xgen-internal-githook" created="Wed, 12 Feb 2020 20:51:59 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;rstam&apos;, &apos;username&apos;: &apos;rstam&apos;, &apos;email&apos;: &apos;robert@robertstam.org&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2960&quot; title=&quot;Unacknowledged writes fail silently when retryWrites=true&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2960&quot;&gt;&lt;del&gt;CSHARP-2960&lt;/del&gt;&lt;/a&gt;: Unacknowledged writes fail silently when retryWrites=true.&lt;br/&gt;
Branch: v2.10.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/61000da0d3a6a14e681470a4e8f3aea99e127cd7&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/61000da0d3a6a14e681470a4e8f3aea99e127cd7&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2874838" author="xgen-internal-githook" created="Wed, 12 Feb 2020 19:56:09 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;rstam&apos;, &apos;username&apos;: &apos;rstam&apos;, &apos;email&apos;: &apos;robert@robertstam.org&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2960&quot; title=&quot;Unacknowledged writes fail silently when retryWrites=true&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2960&quot;&gt;&lt;del&gt;CSHARP-2960&lt;/del&gt;&lt;/a&gt;: Unacknowledged writes fail silently when retryWrites=true.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/3aa87b2ba43130257089abd42fdd60ba2e65ac98&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/3aa87b2ba43130257089abd42fdd60ba2e65ac98&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2857820" author="rstam" created="Mon, 10 Feb 2020 17:39:40 +0000"  >&lt;p&gt;Thank you for reporting this issue. We have been able to reproduce it.&lt;/p&gt;

&lt;p&gt;We have found a bug related to the combination of retryable writes and unacknowledged writes.&lt;/p&gt;

&lt;p&gt;We will fix this ASAP and release a patch release quickly.&lt;/p&gt;

&lt;p&gt;Until then there is a less than ideal work around involving turning off retryable writes, which can be done in the connection string like this:&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;   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;var client = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&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(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;mongodb://localhost/?retryWrites=false&quot;&lt;/span&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;);&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;This is not ideal because it results in retryable writes being disabled, and retryable writes are useful in their own right.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10520">
                    <name>Problem/Incident</name>
                                                                <inwardlinks description="is caused by">
                                        <issuelink>
            <issuekey id="500695">CSHARP-2199</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="500695">CSHARP-2199</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|hwdm6n:</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>