<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:38:41 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>[GODRIVER-2468] Don&apos;t check Context expiration in WithTransaction</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-2468</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;Currently it&apos;s possible for a &lt;tt&gt;WithTransaction&lt;/tt&gt; call to return an error when the context is canceled or times out that does not indicate that the error is related to the context expiring.&lt;/p&gt;

&lt;p&gt;Consider the context &quot;done&quot; check in &lt;tt&gt;WithTransaction&lt;/tt&gt; &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/95de0fb36ca077bbe9a92b3fbf66ef0d28c6eeae/mongo/session.go#L199-L202&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;. If the context expires while handling an error unrelated to context expiration (e.g. a transient server error), the returned error will not indicate that &lt;tt&gt;WithTransaction&lt;/tt&gt; returned due to the context expiring. That is potentially confusing to users because the error returned from &lt;tt&gt;WithTransaction&lt;/tt&gt; doesn&apos;t always specify why &lt;tt&gt;WithTransaction&lt;/tt&gt; stopped retrying.&lt;/p&gt;

&lt;p&gt;Update &lt;tt&gt;WithTransaction&lt;/tt&gt; to continue calling the provided anonymous function until it returns a non-retryable error. Expect that the anonymous function handles the context correctly and returns a non-retryable error when the context expires.&lt;/p&gt;

&lt;p&gt;This is an alternative to &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-2467&quot; title=&quot;Return a Context error if WithTransaction exited due to Context expiration&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-2467&quot;&gt;&lt;del&gt;GODRIVER-2467&lt;/del&gt;&lt;/a&gt; that can be completed in the v1.x driver.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2074694">GODRIVER-2468</key>
            <summary>Don&apos;t check Context expiration in WithTransaction</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="benji.rewis@mongodb.com">Benji Rewis</assignee>
                                    <reporter username="matt.dale@mongodb.com">Matt Dale</reporter>
                        <labels>
                    </labels>
                <created>Wed, 22 Jun 2022 22:02:59 +0000</created>
                <updated>Sat, 28 Oct 2023 11:37:33 +0000</updated>
                            <resolved>Wed, 17 Aug 2022 19:27:20 +0000</resolved>
                                                    <fixVersion>1.10.2</fixVersion>
                                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="4804668" author="xgen-internal-githook" created="Tue, 6 Sep 2022 14:44:05 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Benjamin Rewis&apos;, &apos;email&apos;: &apos;benji.rewis@mongodb.com&apos;, &apos;username&apos;: &apos;benjirewis&apos;}
&lt;p&gt;Message: Stop treating context errors as network errors where possible. (#1045)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-2468&quot; title=&quot;Don&amp;#39;t check Context expiration in WithTransaction&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-2468&quot;&gt;&lt;del&gt;GODRIVER-2468&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1965&quot; title=&quot;Pre-write context expiration should not be considered a network error&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-1965&quot;&gt;&lt;del&gt;GODRIVER-1965&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: release/1.10&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/c4993a52e199b170c31820e99355ed434a26fdc7&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/c4993a52e199b170c31820e99355ed434a26fdc7&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4758526" author="benji.rewis" created="Wed, 17 Aug 2022 19:27:20 +0000"  >&lt;p&gt;We&apos;ve stopped consistently marking context errors as network errors (and adding the &lt;tt&gt;TransientTransactionError&lt;/tt&gt; label), so the context error checks are no longer needed in &lt;tt&gt;WithTransaction&lt;/tt&gt;. If a context error occurs it &lt;em&gt;should&lt;/em&gt; now be handed back to the user and not retried. If a context expires or is canceled after the context check in operation.Execute &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/master/x/mongo/driver/operation.go#L534-L546&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;, the driver may begin the retry process but should return a non-retryable context error before writing or reading from the wire again.&lt;/p&gt;</comment>
                            <comment id="4758520" author="xgen-internal-githook" created="Wed, 17 Aug 2022 19:23:04 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Benjamin Rewis&apos;, &apos;email&apos;: &apos;32186188+benjirewis@users.noreply.github.com&apos;, &apos;username&apos;: &apos;benjirewis&apos;}
&lt;p&gt;Message: Stop treating context errors as network errors where possible. (#1045)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-2468&quot; title=&quot;Don&amp;#39;t check Context expiration in WithTransaction&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-2468&quot;&gt;&lt;del&gt;GODRIVER-2468&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1965&quot; title=&quot;Pre-write context expiration should not be considered a network error&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-1965&quot;&gt;&lt;del&gt;GODRIVER-1965&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: release/1.10&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/486441860bbf033cbe721707b1506a639e9140e9&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/486441860bbf033cbe721707b1506a639e9140e9&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4742060" author="benji.rewis" created="Wed, 10 Aug 2022 19:48:20 +0000"  >&lt;p&gt;We &lt;em&gt;should&lt;/em&gt; be able to remove the context error checks from &lt;tt&gt;WithTransaction&lt;/tt&gt; once we stop marking context expiration with the &lt;tt&gt;TransientTransactionError&lt;/tt&gt; label. &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/pull/1045&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/pull/1045&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4689602" author="benji.rewis" created="Tue, 19 Jul 2022 16:49:12 +0000"  >&lt;p&gt;It seems that removing the check entirely won&apos;t work either. It was added in &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-2001&quot; title=&quot;Session.WithTransaction method endless loop&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-2001&quot;&gt;&lt;del&gt;GODRIVER-2001&lt;/del&gt;&lt;/a&gt; to stop the infinite loop that might happen if &lt;tt&gt;WithTransaction&lt;/tt&gt; is run with an expired context. The Go driver seems to mark context expiration errors (&lt;tt&gt;context.DeadlineExceeded&lt;/tt&gt;, &lt;tt&gt;context.Canceled&lt;/tt&gt; etc) with the &lt;tt&gt;TransientTransactionError&lt;/tt&gt; label &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/master/x/mongo/driver/operation.go#L846&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; if the driver is currently committing a transaction. &lt;/p&gt;

&lt;p&gt;I think we should only append that label if the context is not also expired.&lt;/p&gt;</comment>
                            <comment id="4646016" author="JIRAUSER1258790" created="Tue, 28 Jun 2022 19:57:50 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=benji.rewis%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;benji.rewis@mongodb.com&quot;&gt;benji.rewis@mongodb.com&lt;/a&gt; Thanks for looking into this. Today I heard from someone working on Mongosync that they are still hitting this, so it would be nice if we can have a fix in driver, if that is that is small enough and does not impact other driver behaviors.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;return a non-retryable error (it&apos;s not clear to me how reasonable this is).&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I think even with the current code, this can still happen, if the ctx is cancelled right after &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/95de0fb36ca077bbe9a92b3fbf66ef0d28c6eeae/mongo/session.go#L199-L202&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this check block&lt;/a&gt;, in other words, this check only makes this happening less, so my point is removing this check does not change the current semantics of the API.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;I think the most idiomatic solution would be to return a context error&#160;&lt;em&gt;wrapping&lt;/em&gt;&#160;the last operation error to provide the most info to users&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I think there might be a potential problem with this approach: This changes the current behavior because currently if the ctx is cancelled while executing the callback, the result is some kind of execution error with a `context.Cancelled` error wrapped inside, but what you&apos;re suggesting is the other way around, by wrapping the execution error inside `context.Cancelled`. This is a behavior change, and could still result in the original issue if users are checking the root cause of the returned error which is a common practice.&lt;/p&gt;</comment>
                            <comment id="4645605" author="benji.rewis" created="Tue, 28 Jun 2022 17:45:19 +0000"  >&lt;p&gt;I do think it&apos;s odd that we return the last operation error and not the actual context error when we detect an error in &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/95de0fb36ca077bbe9a92b3fbf66ef0d28c6eeae/mongo/session.go#L199-L202&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this block&lt;/a&gt;. It also seems odd to me, however, to remove that check and rely on the provided callback function to respect the context (reasonable enough) &lt;em&gt;and&lt;/em&gt; return a non-retryable error (it&apos;s not clear to me how reasonable this is).&lt;/p&gt;

&lt;p&gt;I think the most idiomatic solution would be to return a context error &lt;em&gt;wrapping&lt;/em&gt; the last operation error to provide the most info to users. Since this does not seem super urgent, I would opt to wait to do &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-2467&quot; title=&quot;Return a Context error if WithTransaction exited due to Context expiration&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-2467&quot;&gt;&lt;del&gt;GODRIVER-2467&lt;/del&gt;&lt;/a&gt; as part of 2.0 and close this ticket. What are your thoughts &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=wenbin.zhu%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;wenbin.zhu@mongodb.com&quot;&gt;wenbin.zhu@mongodb.com&lt;/a&gt;/&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=matt.dale%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;matt.dale@mongodb.com&quot;&gt;matt.dale@mongodb.com&lt;/a&gt;?&lt;/p&gt;</comment>
                            <comment id="4642855" author="JIRAUSER1258790" created="Mon, 27 Jun 2022 18:44:52 +0000"  >&lt;p&gt;Related conversation: &lt;a href=&quot;https://mongodb.slack.com/archives/C7WJZNUTA/p1655484492898759&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://mongodb.slack.com/archives/C7WJZNUTA/p1655484492898759&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1679738">GODRIVER-1965</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1706396">GODRIVER-2001</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2074688">GODRIVER-2467</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </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_10257" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Documentation Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11861"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>GODRIVER-1885</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_21553" key="com.atlassian.jira.plugin.system.customfieldtypes:labels">
                        <customfieldname>Quarter</customfieldname>
                        <customfieldvalues>
                                        <label>FY23Q2</label>
            <label>FY23Q3</label>
    
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i0ihvk:</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>