<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:30:43 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-53366] Delay between user creation / update and access rights being updated in sharded clusters</title>
                <link>https://jira.mongodb.org/browse/SERVER-53366</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Since Mongo 4.4, we are getting spurious errors in our test suite because there is a delay between the creation of a mongo user and the access rights being actually available, but only in sharded clusters.&lt;/p&gt;

&lt;p&gt;Our test creates a user that has a read only role to a single database and then instantly tries reading from the database using this user. On 4.4 this test fails about 90% of the time. It seems like there is a delay in the propagation of access rights.&lt;/p&gt;

&lt;p&gt;I tried adding a delay of 10 seconds between the call to create the user and the call that tests the access rights and the issue no longer appears.&lt;/p&gt;

&lt;p&gt;So it seems like in Mongo 4.4 user creation and/or propagation is asynchronous, but I could not find anything in the docs about this. I tried setting the write concern to all nodes but that does not fix it.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1567695">SERVER-53366</key>
            <summary>Delay between user creation / update and access rights being updated in sharded clusters</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="9">Done</resolution>
                                        <assignee username="eric.sedor@mongodb.com">Eric Sedor</assignee>
                                    <reporter username="simon.bernier-st-pierre@ubisoft.com">Simon Bernier St-Pierre</reporter>
                        <labels>
                    </labels>
                <created>Mon, 14 Dec 2020 18:42:51 +0000</created>
                <updated>Mon, 15 Mar 2021 23:10:51 +0000</updated>
                            <resolved>Mon, 15 Mar 2021 23:10:51 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="3585655" author="eric.sedor" created="Wed, 27 Jan 2021 19:11:30 +0000"  >&lt;p&gt;That sounds right &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=simon.bernier-st-pierre%40ubisoft.com&quot; class=&quot;user-hover&quot; rel=&quot;simon.bernier-st-pierre@ubisoft.com&quot;&gt;simon.bernier-st-pierre@ubisoft.com&lt;/a&gt; about accounting for load balancers. For the assistance working out system behavior in issues like this, we&apos;d like to encourage you to start by asking our community for help by posting on the &lt;a href=&quot;https://community.mongodb.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoDB Developer Community Forums&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I&apos;m not aware of a direct change to user cacheing but sharding mechanisms have evolved in a few ways over those versions.&lt;/p&gt;

&lt;p&gt;If you&apos;re able to help us reproduce a cache propagation delay and still see a failure on a mongos after running invalidateUserCache we&apos;d want to look into that.&lt;/p&gt;

&lt;p&gt;Sincerely,&lt;br/&gt;
Eric&lt;/p&gt;</comment>
                            <comment id="3568498" author="JIRAUSER1257910" created="Fri, 15 Jan 2021 22:40:07 +0000"  >&lt;p&gt;Hey, thanks for checking this. It seems like the call to invalidateUserCache does not clear the cache in my case. I added in my tests a simple sleep of 30 seconds (to match userCacheInvalidationIntervalSecs) after every call that modifies users and this has fixed my issue.&lt;/p&gt;

&lt;p&gt;I only have this problem with 4.2 and 4.4, so perhaps the caching mechanism has been changed between 4.0 and 4.2?&lt;/p&gt;

&lt;p&gt;I think you may have brought an interesting point however. We have multiple mongos instances which are behind a load balancer. So it&apos;s possible that the user cache only gets flushed on one of them, the one we happen to get load balanced to? In that case we need to flush each mongos individually.&lt;/p&gt;</comment>
                            <comment id="3568397" author="eric.sedor" created="Fri, 15 Jan 2021 21:46:42 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=simon.bernier-st-pierre%40ubisoft.com&quot; class=&quot;user-hover&quot; rel=&quot;simon.bernier-st-pierre@ubisoft.com&quot;&gt;simon.bernier-st-pierre@ubisoft.com&lt;/a&gt; theoretically you would call invlidateUserCache on the mongos you will be authing against with the new/updated user.&lt;/p&gt;

&lt;p&gt;Unfortunately, I have not been able to reproduce a user creation delay yet. Can you provide clarity on where each command is getting executed by ensuring you have MongoClient objects to each mongos, and are you able to provide the python code that reproduces the OperationFailure?&lt;/p&gt;</comment>
                            <comment id="3548145" author="JIRAUSER1257910" created="Tue, 5 Jan 2021 01:52:38 +0000"  >&lt;p&gt;Hi Eric, thanks for the reply.&lt;/p&gt;

&lt;p&gt;I&apos;ve done more testing and I have noticed that this issue also occurs on Mongo 4.2. So 3.6 and 4.0 are unaffected and 4.2 and 4.4 are.&lt;/p&gt;

&lt;p&gt;I&apos;ve tried adding a call to `invalidateUserCache` right after adding my user but I still get the issue for 4.2 and 4.4 on sharded clusters.&lt;/p&gt;

&lt;p&gt;So what I&apos;m doing precisely is calling `createUser/updateUser`, then calling `invalidateUserCache` and then creating a connection string for this user and trying to perform legal actions with it.&lt;/p&gt;

&lt;p&gt;I get an error like this, only on sharded clusters:&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;pymongo.errors.OperationFailure: &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;not&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; authorized on running_man to execute command { find: &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;true_lies&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;Is this `invlidateUserCache` function supposed to be called on mongos or each shard? There&apos;s no indication in the docs about that.&lt;/p&gt;</comment>
                            <comment id="3548061" author="eric.sedor" created="Mon, 4 Jan 2021 23:28:55 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=simon.bernier-st-pierre%40ubisoft.com&quot; class=&quot;user-hover&quot; rel=&quot;simon.bernier-st-pierre@ubisoft.com&quot;&gt;simon.bernier-st-pierre@ubisoft.com&lt;/a&gt; and thanks for your patience,&lt;/p&gt;

&lt;p&gt;It&apos;s not immediately clear to me what would have changed from 4.2 to 4.4 around this, but we&apos;d expect the 30 second default for &lt;a href=&quot;https://docs.mongodb.com/manual/reference/parameters/#param.userCacheInvalidationIntervalSecs&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;userCacheInvalidationIntervalSecs&lt;/a&gt; is a factor.&lt;/p&gt;

&lt;p&gt;To avoid a 10 second wait, can you try either reducing userCacheInvalidationIntervalSecs for test purposes, or leveraging the &lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/invalidateUserCache/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;invalidateUserCache&lt;/a&gt; command, and let us know if that helps?&lt;/p&gt;

&lt;p&gt;Eric&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 14 Dec 2020 19:43:21 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 2 weeks 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_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>eric.sedor@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 years, 2 weeks ago
                        </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>eric.sedor@mongodb.com</customfieldvalue>
            <customfieldvalue>simon.bernier-st-pierre@ubisoft.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hylqc7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hy7kzz:</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_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>
                                    <customfieldvalue><![CDATA[eric.sedor@mongodb.com]]></customfieldvalue>
    

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

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