<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:48:25 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>[SERVER-38257] TransactionParticipant::abortArbitraryTransaction can cause incorrect transaction metrics to be recorded</title>
                <link>https://jira.mongodb.org/browse/SERVER-38257</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Based on my conversation with &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=tess.avitabile&quot; class=&quot;user-hover&quot; rel=&quot;tess.avitabile&quot;&gt;tess.avitabile&lt;/a&gt;, I think the following bug exists in &lt;b&gt;transaction metrics active and inactive counts&lt;/b&gt; (the bug may affect other metrics as well, I&apos;m not sure):&lt;/p&gt;

&lt;p&gt;&amp;#8212;&lt;/p&gt;

&lt;p&gt;If a transaction is aborted, whether the number of active or inactive transactions is decremented&#160;depends on whether the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca/src/mongo/db/transaction_participant.cpp#L1171&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;TxnResources were stashed&lt;/a&gt;&#160;at the time of the abort:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;if they &lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca/src/mongo/db/transaction_participant.cpp#L1175&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;were stashed&lt;/a&gt;,&#160;the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca0364f3f6481320a6bcaff709b564ebaa3/src/mongo/db/transaction_metrics_observer.cpp#L189&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;inactive count&lt;/a&gt;&#160;is decremented&lt;/li&gt;
	&lt;li&gt;if they &lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca/src/mongo/db/transaction_participant.cpp#L1188&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;were not stashed&lt;/a&gt;, the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca0364f3f6481320a6bcaff709b564ebaa3/src/mongo/db/transaction_metrics_observer.cpp#L165&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;active count&lt;/a&gt;&#160;is decremented.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This usually works because in a transaction request&apos;s flow:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;First, TransactionParticipant::beginOrContinue &lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca/src/mongo/db/transaction_participant.cpp#L360&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;calls&lt;/a&gt;&#160;TransactionMetricsObserver::onStart, which &lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca0364f3f6481320a6bcaff709b564ebaa3/src/mongo/db/transaction_metrics_observer.cpp#L57&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;increments&lt;/a&gt;&#160;the number of currently inactive transactions&lt;/li&gt;
	&lt;li&gt;Later, TransactionParticipant::unstashTransactionResources calls TransactionMetricsObserver::onUnstash (both if the TxnResources &lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca/src/mongo/db/transaction_participant.cpp#L673&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;already exist&lt;/a&gt;, or if they were &lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca/src/mongo/db/transaction_participant.cpp#L740&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;just created&lt;/a&gt;),&#160;which&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca0364f3f6481320a6bcaff709b564ebaa3/src/mongo/db/transaction_metrics_observer.cpp#L95&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;increments&lt;/a&gt;&#160;the number of currently active transactions and &lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca0364f3f6481320a6bcaff709b564ebaa3/src/mongo/db/transaction_metrics_observer.cpp#L96&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;decrements&lt;/a&gt;&#160;the number of currently inactive transactions.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;However, TransactionParticipant::abortArbitraryTransaction can be called outside of a checked out Session, and so the following sequence can happen, which causes the metrics to be incorrect for a short period:&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;// inactive: 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;   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;// active: 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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&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;// Starts *new* transaction; increments inactive count&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;Thread 1: TransactionParticipant::beginOrContinue&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;&amp;nbsp;&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;// inactive: 1&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;// active: 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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&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;// TxnResources have not been created, so _txnResourceStash is boost::none; interprets this as meaning the transaction is active and decrements active count&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;Thread 2: TransactionParticipant::abortArbitraryTransaction&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;&amp;nbsp;&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;// inactive: 1 &amp;lt;----- metric incorrect&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;// active: -1 &amp;lt;----- metric incorrect&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;&amp;nbsp;&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;Thread 1: TransactionParticipant::unstashTransactionResources&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;&amp;nbsp;&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;// inactive: 0 &amp;lt;----- metric remedied&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;// active: 0 &amp;lt;----- metric remedied&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;However, if TransactionParticipant::unstashTransactionResources throws before calling TransactionMetricsObserver:onUnstash, for example by timing out waiting to &lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c46ca/src/mongo/db/transaction_participant.cpp#L727&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;acquire the GlobalLock&lt;/a&gt;, then the inactive and active counts may remain permanently incorrect.&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="638505">SERVER-38257</key>
            <summary>TransactionParticipant::abortArbitraryTransaction can cause incorrect transaction metrics to be recorded</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="lingzhi.deng@mongodb.com">Lingzhi Deng</assignee>
                                    <reporter username="esha.maharishi@mongodb.com">Esha Maharishi</reporter>
                        <labels>
                            <label>open_todo_in_code</label>
                            <label>prepare_diagnostics</label>
                    </labels>
                <created>Mon, 26 Nov 2018 22:14:10 +0000</created>
                <updated>Sun, 29 Oct 2023 22:26:21 +0000</updated>
                            <resolved>Mon, 1 Apr 2019 16:14:02 +0000</resolved>
                                    <version>4.1.5</version>
                                    <fixVersion>4.1.10</fixVersion>
                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="2197878" author="xgen-internal-githook" created="Mon, 1 Apr 2019 16:12:29 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;email&apos;: &apos;lingzhi.deng@mongodb.com&apos;, &apos;name&apos;: &apos;Lingzhi Deng&apos;, &apos;username&apos;: &apos;ldennis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-38257&quot; title=&quot;TransactionParticipant::abortArbitraryTransaction can cause incorrect transaction metrics to be recorded&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-38257&quot;&gt;&lt;del&gt;SERVER-38257&lt;/del&gt;&lt;/a&gt;: Make transactionMetricsObserver.onAbort self-contained&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;onAbort() calls _onAbortActive() if _singleTransactionStats.isActive(), otherwise it calls _onAbortInactive().&lt;/li&gt;
	&lt;li&gt;add test case&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/5b2225b699fd47358e37aff0eaeab1285a1bd1cb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/5b2225b699fd47358e37aff0eaeab1285a1bd1cb&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="2157608" author="tess.avitabile" created="Wed, 20 Feb 2019 20:53:47 +0000"  >&lt;p&gt;Got it, that sounds fine! Same for the other ticket.&lt;/p&gt;</comment>
                            <comment id="2157604" author="judah.schvimer" created="Wed, 20 Feb 2019 20:51:32 +0000"  >&lt;p&gt;I wanted to signal (mostly to myself) that this was lower priority in the prepare epic, but still required. This seemed like the best way. I can change it back if you&apos;d prefer not to (somewhat) overload the meaning of the field.&lt;/p&gt;</comment>
                            <comment id="2157569" author="tess.avitabile" created="Wed, 20 Feb 2019 20:29:23 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=judah.schvimer&quot; class=&quot;user-hover&quot; rel=&quot;judah.schvimer&quot;&gt;judah.schvimer&lt;/a&gt;, why has the priority been changed to minor?&lt;/p&gt;</comment>
                            <comment id="2112444" author="xgen-internal-githook" created="Fri, 11 Jan 2019 16:52:37 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;tessavitabile&apos;, &apos;email&apos;: &apos;tess.avitabile@mongodb.com&apos;, &apos;name&apos;: &apos;Tess Avitabile&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-38257&quot; title=&quot;TransactionParticipant::abortArbitraryTransaction can cause incorrect transaction metrics to be recorded&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-38257&quot;&gt;&lt;del&gt;SERVER-38257&lt;/del&gt;&lt;/a&gt; Disable allCountsNonNegative invariant in multi_statement_transaction_atomicity_isolation_metrics_test.js&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/eaa91b0822c4ad59cb72e9274b18f4d32ce2eacf&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/eaa91b0822c4ad59cb72e9274b18f4d32ce2eacf&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2088567" author="tess.avitabile" created="Wed, 12 Dec 2018 16:52:07 +0000"  >&lt;p&gt;That seems like a reasonable solution to me to have two in-progress states. If we don&apos;t like how it looks, we could consult the metrics tracker to check the active/inactive state.&lt;/p&gt;

&lt;p&gt;That seems quite plausible that this is the cause of BF-11283.&lt;/p&gt;</comment>
                            <comment id="2088491" author="william.schultz" created="Wed, 12 Dec 2018 16:05:38 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=tess.avitabile&quot; class=&quot;user-hover&quot; rel=&quot;tess.avitabile&quot;&gt;tess.avitabile&lt;/a&gt; At this point could we consider just making &lt;tt&gt;kInProgressActive&lt;/tt&gt; and &lt;tt&gt;kInProgressInactive&lt;/tt&gt; states in &lt;tt&gt;TransactionState&lt;/tt&gt;? They would be sub-states of &lt;tt&gt;kInProgress&lt;/tt&gt;. I think this would be a clear way to resolve the ambiguity around how to check whether a transaction is active or inactive. We initially used the presence/absence of &lt;tt&gt;_txnResourceStash&lt;/tt&gt; to check this because it seemed appropriate, but it is becoming clear that this doesn&apos;t quite work in all cases. We could use the metrics tracker to check the active/inactive state, but we already have &lt;tt&gt;TransactionState&lt;/tt&gt;, which is a nice state machine mechanism for validating state transitions. I think this approach would have also allowed us to solve the issue from &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37189&quot; title=&quot;transactions.currentActive has a value of -1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37189&quot;&gt;&lt;del&gt;SERVER-37189&lt;/del&gt;&lt;/a&gt; in a cleaner manner.&lt;/p&gt;

&lt;p&gt;On a related note, I wonder if BF-11283 is a manifestation of this issue. I have not investigated thoroughly, but the symptoms look like what is described in this ticket description i.e. the metrics end up with &lt;tt&gt;currentInactive=1, currentActive=-1&lt;/tt&gt;. It has occurred very frequently, and recently i.e. BFG-115312.&lt;/p&gt;</comment>
                            <comment id="2088382" author="tess.avitabile" created="Wed, 12 Dec 2018 14:49:20 +0000"  >&lt;p&gt;&lt;tt&gt;inMultiDocumentTransaction()&lt;/tt&gt; just checks whether the state is &lt;tt&gt;kInProgress&lt;/tt&gt;. This does not distinguish between &quot;active&quot; (an operation has unstashed resources) and &quot;inactive&quot;. A transaction remains in the &lt;tt&gt;kInProgress&lt;/tt&gt; state until it is prepared, committed, or aborted.&lt;/p&gt;</comment>
                            <comment id="2087904" author="kaloian.manassiev" created="Wed, 12 Dec 2018 00:15:57 +0000"  >&lt;p&gt;What about using &lt;a href=&quot;https://github.com/mongodb/mongo/blob/f948fbcf86d104d70889d7d6a1caa83b4d78a6a8/src/mongo/db/transaction_participant.h#L216&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;inMultiDocumentTransaction&lt;/tt&gt;&lt;/a&gt; for this check instead? That&apos;s what I was planning to use for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-38456&quot; title=&quot;killSessionsLocalKillTransactions must filter for sessions with running transactions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-38456&quot;&gt;&lt;del&gt;SERVER-38456&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="2087098" author="tess.avitabile" created="Tue, 11 Dec 2018 16:11:39 +0000"  >&lt;p&gt;I believe there is still a bug here, even after it&apos;s no longer possible to modify a TransactionParticipant without checking out the session.&lt;/p&gt;

&lt;p&gt;1) Operation runs unstashTransactionResources(), which throws. The transaction is in state kInProgress, _txnResourceStash is empty, and the transaction is considered &quot;inactive&quot; in the metrics.&lt;/p&gt;

&lt;p&gt;2) killSessions, transaction expiration thread, or stepdown/shutdown checks out the session and runs abortArbitraryTransaction(). Since _txnResourceStash is empty, this calls&#160;_transactionMetricsObserver.onAbortActive(). (I don&apos;t think abortArbitraryTransaction() will go away&#8211;it will just no longer run concurrently with transaction operations.)&lt;/p&gt;

&lt;p&gt;We should not rely on _txnResourceStash to determine if a transaction is active. One option is that abortArbitraryTransaction() could now always call _transactionMetricsObserver.onAbortInactive(), since it no longer can run concurrently with a transaction operation. Another option is to go back to the 4.0 model, where we consult the metrics-tracker about whether the transaction is in the active or inactive state.&lt;/p&gt;</comment>
                            <comment id="2086539" author="judah.schvimer" created="Tue, 11 Dec 2018 01:14:16 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kaloian.manassiev&quot; class=&quot;user-hover&quot; rel=&quot;kaloian.manassiev&quot;&gt;kaloian.manassiev&lt;/a&gt;, I don&apos;t see how this could happen without &lt;tt&gt;abortArbitraryTransaction&lt;/tt&gt; still, since that was how we got the incorrect metrics in the first place. Am I missing anything? &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=esha.maharishi&quot; class=&quot;user-hover&quot; rel=&quot;esha.maharishi&quot;&gt;esha.maharishi&lt;/a&gt;, thoughts?&lt;/p&gt;</comment>
                            <comment id="2086329" author="kaloian.manassiev" created="Mon, 10 Dec 2018 21:45:53 +0000"  >&lt;p&gt;After &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37923&quot; title=&quot;Make the chunk migration recipient logic check-out sessions it is operating on&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37923&quot;&gt;&lt;del&gt;SERVER-37923&lt;/del&gt;&lt;/a&gt;, transaction abort will always check-out the session (aborting the current owner operation context if necessary) so there should never be a case where &lt;tt&gt;unstashTransactionResources&lt;/tt&gt; threw because the participant became invalidated due to a concurrent abort. However, looking at the code there are other situations where it can throw, for example where read concern is &lt;a href=&quot;https://github.com/mongodb/mongo/blob/00520c2e0b89483e390ecb25cd3291ca8fa30c0f/src/mongo/db/transaction_participant.cpp#L705&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;passed&lt;/a&gt; after the first statement. Not sure what the effect is of those.&lt;/p&gt;</comment>
                            <comment id="2078838" author="greg.mckeon" created="Mon, 3 Dec 2018 18:39:10 +0000"  >&lt;p&gt;Since &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kaloian.manassiev&quot; class=&quot;user-hover&quot; rel=&quot;kaloian.manassiev&quot;&gt;kaloian.manassiev&lt;/a&gt; is removing TransactionParticipant::abortArbitraryTransaction, we believe this will go away.  We should check that this isn&apos;t a bug in 4.0 and mark as dependent on the Session catalog refactor for 4.1.&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>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>13.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 3 Dec 2018 18:39:10 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 45 weeks, 2 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1032</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 45 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>esha.maharishi@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>greg.mckeon@mongodb.com</customfieldvalue>
            <customfieldvalue>judah.schvimer@mongodb.com</customfieldvalue>
            <customfieldvalue>kaloian.manassiev@mongodb.com</customfieldvalue>
            <customfieldvalue>lingzhi.deng@mongodb.com</customfieldvalue>
            <customfieldvalue>tess.avitabile@mongodb.com</customfieldvalue>
            <customfieldvalue>william.schultz@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hudoa7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|huglrz:</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>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="2896">Repl 2019-04-08</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hudajj:</customfieldvalue>

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