<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:49: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>[CSHARP-4897] Index was outside the bounds of the array on changestream cursor</title>
                <link>https://jira.mongodb.org/browse/CSHARP-4897</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;We are using changestream using c# mongodb driver to do some realtime work. We received an error randomly after connection to the events.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;em&gt;$Index was outside the bounds of the array.&lt;/em&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;var options = new ChangeStreamOptions { ResumeAfter = resumeToken, BatchSize = 5 };&lt;/p&gt;

&lt;p&gt;CancellationTokenSource cancelTokenSource = new CancellationTokenSource();&lt;br/&gt;
CancellationToken token = cancelTokenSource.Token;&lt;/p&gt;

&lt;p&gt;try {&lt;br/&gt;
&#160; using(var cursor = await mongoclient.WatchAsync(pipeline, options, cancellationToken: token)) {&lt;br/&gt;
&#160; &#160; await cursor.ForEachAsync(async change =&amp;gt; &lt;/p&gt;
{
&#160; &#160; &#160;&#160;
&#160; &#160; }
&lt;p&gt;, cancellationToken: token);&lt;br/&gt;
&#160; }&lt;br/&gt;
} catch (Exception ex) {&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;On this line 109 await cursor.ForEachAsync we receive this error. This happens after sometime like 8,9 hours every time.&#160; Sharing the stacktrace&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;at Microsoft.Extensions.Logging.LogValuesFormatter.GetValue(Object[] values, Int32 index) at Microsoft.Extensions.Logging.FormattedLogValues.GetEnumerator()+MoveNext() at Serilog.Extensions.Logging.SerilogLogger.Log&lt;span class=&quot;error&quot;&gt;&amp;#91;TState&amp;#93;&lt;/span&gt;(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter) at Microsoft.Extensions.Logging.Logger`1.Microsoft.Extensions.Logging.ILogger.Log&lt;span class=&quot;error&quot;&gt;&amp;#91;TState&amp;#93;&lt;/span&gt;(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter) at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args) at SyncServer.Services.MultiDatabaseChangeStreamManager.&amp;lt;&amp;gt;c&lt;/em&gt;&lt;em&gt;DisplayClass9_0.&amp;lt;&amp;lt;StartChangeStreams&amp;gt;b&lt;/em&gt;&lt;em&gt;6&amp;gt;d.MoveNext() in /app/jenkins/workspace/flecx-prod-changestream/src/Host/SyncServer/Services/MultiDatabaseChangeStreamManager.cs:line 167 &amp;#8212; End of stack trace from previous location &amp;#8212; at MongoDB.Driver.IAsyncCursorExtensions.ForEachAsync&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(IAsyncCursor`1 source, Func`3 processor, CancellationToken cancellationToken) at SyncServer.Services.MultiDatabaseChangeStreamManager.StartChangeStreams() in /app/jenkins/workspace/flecx-prod-changestream/src/Host/SyncServer/Services/MultiDatabaseChangeStreamManager.cs:line 109&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://jira.mongodb.org/secure/attachment/500195/500195_image-2024-01-02-16-19-19-680.png&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2534964">CSHARP-4897</key>
            <summary>Index was outside the bounds of the array on changestream cursor</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="13203">Gone away</resolution>
                                        <assignee username="boris.dogadov@mongodb.com">Boris Dogadov</assignee>
                                    <reporter username="kghazanfar4@gmail.com">Ghazanfar Khan</reporter>
                        <labels>
                    </labels>
                <created>Tue, 2 Jan 2024 11:19:24 +0000</created>
                <updated>Fri, 12 Jan 2024 17:33:06 +0000</updated>
                            <resolved>Fri, 12 Jan 2024 17:33:06 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="6007864" author="JIRAUSER1257742" created="Fri, 12 Jan 2024 17:32:52 +0000"  >&lt;p&gt;Thank you for the update &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kghazanfar4%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;kghazanfar4@gmail.com&quot;&gt;kghazanfar4@gmail.com&lt;/a&gt;&#160;&lt;br/&gt;
I will close this ticket as resolved.&lt;/p&gt;</comment>
                            <comment id="6006668" author="JIRAUSER1258756" created="Fri, 12 Jan 2024 11:07:30 +0000"  >&lt;p&gt;Hi, The issue have been resolved. Target replica set have members associated with domain names not with ips. We listed those ips in host files.&lt;/p&gt;</comment>
                            <comment id="5994671" author="JIRAUSER1257742" created="Mon, 8 Jan 2024 17:54:33 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kghazanfar4%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;kghazanfar4@gmail.com&quot;&gt;kghazanfar4@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;This exception points to a networking problem.&lt;br/&gt;
Driver can recover from transient networking issues, but if that causes any further issues I would suggest troubleshooting your network setup.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</comment>
                            <comment id="5992346" author="JIRAUSER1258756" created="Sun, 7 Jan 2024 14:29:32 +0000"  >&lt;p&gt;Hi thanks for reporting logs statement was throwing that exception. Now this is the exception that is raising&lt;/p&gt;

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

&lt;p&gt;A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector&lt;/p&gt;
{ AllowedLatencyRange = 00:00:00.0150000 }
&lt;p&gt;, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : &quot;2&quot;, ConnectionMode : &quot;ReplicaSet&quot;, Type : &quot;ReplicaSet&quot;, State : &quot;Connected&quot;, Servers : [{ ServerId: &quot;&lt;/p&gt;
{ ClusterId : 2, EndPoint : &quot;Unspecified/ibdxanv-cdb02.corp.ibexglobal.com:27017&quot; }
&lt;p&gt;&quot;, EndPoint: &quot;Unspecified/ibdxanv-cdb02.corp.ibexglobal.com:27017&quot;, ReasonChanged: &quot;Heartbeat&quot;, State: &quot;Connected&quot;, ServerVersion: 5.0.0, TopologyVersion: { &quot;processId&quot; : ObjectId(&quot;659524be65487d9bd258156d&quot;), &quot;counter&quot; : NumberLong(1) }, Type: &quot;ReplicaSetArbiter&quot;, WireVersionRange: &quot;&lt;span class=&quot;error&quot;&gt;&amp;#91;0, 13&amp;#93;&lt;/span&gt;&quot;, LastHeartbeatTimestamp: &quot;2024-01-06T20:58:29.1317025Z&quot;, LastUpdateTimestamp: &quot;2024-01-06T20:58:29.1317027Z&quot; }, { ServerId: &quot;&lt;/p&gt;
{ ClusterId : 2, EndPoint : &quot;Unspecified/ibdxanv-nosql02.corp.ibexglobal.com:27017&quot; }
&lt;p&gt;&quot;, EndPoint: &quot;Unspecified/ibdxanv-nosql02.corp.ibexglobal.com:27017&quot;, ReasonChanged: &quot;Heartbeat&quot;, State: &quot;Disconnected&quot;, ServerVersion: , TopologyVersion: , Type: &quot;Unknown&quot;, HeartbeatException: &quot;MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---&amp;gt; System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): Name or service not known at System.Net.Dns.GetHostEntryOrAddressesCore(String hostName, Boolean justAddresses, AddressFamily addressFamily, ValueStopwatch stopwatch) at System.Net.Dns.GetHostAddresses(String hostNameOrAddress, AddressFamily family) at MongoDB.Driver.Core.Connections.TcpStreamFactory.ResolveEndPoints(EndPoint initial) at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStream(EndPoint endPoint, CancellationToken cancellationToken) at MongoDB.Driver.Core.Connections.SslStreamFactory.CreateStream(EndPoint endPoint, CancellationToken cancellationToken) at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancellationToken) &amp;#8212; End of inner exception stack trace &amp;#8212; at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancellationToken) at MongoDB.Driver.Core.Connections.BinaryConnection.Open(CancellationToken cancellationToken) at MongoDB.Driver.Core.Servers.ServerMonitor.InitializeConnection(CancellationToken cancellationToken) at MongoDB.Driver.Core.Servers.ServerMonitor.Heartbeat(CancellationToken cancellationToken)&quot;, LastHeartbeatTimestamp: &quot;2024-01-06T20:58:32.9818476Z&quot;, LastUpdateTimestamp: &quot;2024-01-06T20:58:32.9818478Z&quot; }, { ServerId: &quot;&lt;/p&gt;
{ ClusterId : 2, EndPoint : &quot;Unspecified/ibdxanv-nosql03.corp.ibexglobal.com:27017&quot; }
&lt;p&gt;&quot;, EndPoint: &quot;Unspecified/ibdxanv-nosql03.corp.ibexglobal.com:27017&quot;, ReasonChanged: &quot;Heartbeat&quot;, State: &quot;Connected&quot;, ServerVersion: 5.0.0, TopologyVersion: { &quot;processId&quot; : ObjectId(&quot;658d57cbcbad5cc5d47ebb13&quot;), &quot;counter&quot; : NumberLong(3) }, Type: &quot;ReplicaSetSecondary&quot;, WireVersionRange: &quot;&lt;span class=&quot;error&quot;&gt;&amp;#91;0, 13&amp;#93;&lt;/span&gt;&quot;, LastHeartbeatTimestamp: &quot;2024-01-06T20:58:31.0034211Z&quot;, LastUpdateTimestamp: &quot;2024-01-06T20:58:31.0034216Z&quot; }] }.&#160;&lt;/p&gt;</comment>
                            <comment id="5989839" author="JIRAUSER1257742" created="Fri, 5 Jan 2024 19:33:55 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kghazanfar4%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;kghazanfar4@gmail.com&quot;&gt;kghazanfar4@gmail.com&lt;/a&gt;&#160;&lt;/p&gt;

&lt;p&gt;It&apos;s still does not look like the failure is caused by the driver.&lt;br/&gt;
We would be able to investigate further if you could provide a stacktrace that points to driver code, and/or reproducible code sample.&lt;/p&gt;

&lt;p&gt;Another thought, unrelated to C# driver, is that lines of code like:&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;&#160;_logger.LogInformation($&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;ReplayChangeToTarget Exception :: {ex.Message}&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;, ex.ToString());&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;Are not safe.&#160; as if ex.Message contains quotes (for example ex.Message == &quot;some text {id} more text&quot;), they will be interpreted as a log parameter. And that would cause exactly the exception you are receiving.&lt;br/&gt;
Please also note that there is no placeholder for a parameter in the log template, yet a parameter is passed (ex.ToString()).&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="5988350" author="JIRAUSER1258756" created="Fri, 5 Jan 2024 11:14:34 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;Dotnet version = 6.0&lt;/p&gt;

&lt;p&gt;Driver version = 2.20&lt;/p&gt;

&lt;p&gt;OS = linux&lt;/p&gt;

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

&lt;p&gt;I have added all the code in this post&lt;/p&gt;

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

&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/77747804/mongodb-c-sharp-changestream-cursor-index-was-outside-the-bounds-of-the-array&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/77747804/mongodb-c-sharp-changestream-cursor-index-was-outside-the-bounds-of-the-array&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;We are receiving this error randomly.&lt;/p&gt;</comment>
                            <comment id="5987658" author="JIRAUSER1257742" created="Fri, 5 Jan 2024 00:25:53 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kghazanfar4%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;kghazanfar4@gmail.com&quot;&gt;kghazanfar4@gmail.com&lt;/a&gt;&#160;&lt;/p&gt;

&lt;p&gt;I failed to find any evidence to an exception within the driver in the provided stacktrace&#160;&lt;br/&gt;
it looks like the exception might be raised within the delegate passed to ForEachAsync.&lt;/p&gt;

&lt;p&gt;To investigate further, could please share:&lt;br/&gt;
1. Driver, dotnet and OS versions being used.&lt;br/&gt;
2. A self contained repro.&lt;br/&gt;
3. Or a stacktrace pointing to a failure within the driver with a sample code.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</comment>
                            <comment id="5982659" author="JIRAUSER1258756" created="Wed, 3 Jan 2024 12:28:20 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=dbeng-pm-bot&quot; class=&quot;user-hover&quot; rel=&quot;dbeng-pm-bot&quot;&gt;dbeng-pm-bot&lt;/a&gt;&#160; any update?&lt;/p&gt;</comment>
                            <comment id="5979029" author="dbeng-pm-bot" created="Tue, 2 Jan 2024 11:19:27 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kghazanfar4%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;kghazanfar4@gmail.com&quot;&gt;kghazanfar4@gmail.com&lt;/a&gt;, thank you for reporting this issue! The team will look into it and get back to you soon. &lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="500195" name="image-2024-01-02-16-19-19-680.png" size="114790" author="kghazanfar4@gmail.com" created="Tue, 2 Jan 2024 11:19:20 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                        <customfield id="customfield_23812" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Assigned Team</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="26445"><![CDATA[Dotnet Drivers]]></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_14266" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Documentation Changes Summary</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;1. What would you like to communicate to the user about this feature?&lt;br/&gt;
2. Would you like the user to see examples of the syntax and/or executable code and its output?&lt;br/&gt;
3. Which versions of the driver/connector does this apply to?&lt;/p&gt;</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i2o3no:</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>