<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:41:44 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-2146] System.IO.EndOfStreamException when iterating change stream cursor</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2146</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I got following exception when tried to resume watching changes in collection with new change stream feature in MongoDB 3.6.&lt;/p&gt;

&lt;p&gt;This error happened on 2 out of 6 collections I watched. It started occurring after 6-12 hours and it worked normally before. To resolve it I needed to restart watching for the events without resume token which is unfortunate because it can cause loss of information in my system.&lt;/p&gt;

&lt;p&gt;System.IO.EndOfStreamException: Attempted to read past the end of the stream.&lt;br/&gt;
   at void MongoDB.Bson.IO.BsonStreamExtensions.ReadBytes(BsonStream stream, byte[] buffer, int offset, int count)&lt;br/&gt;
   at int MongoDB.Bson.IO.BsonStreamAdapter.ReadInt32()&lt;br/&gt;
   at int MongoDB.Bson.IO.BsonBinaryReader.ReadSize()&lt;br/&gt;
   at void MongoDB.Bson.IO.BsonBinaryReader.ReadStartDocument()&lt;br/&gt;
   at BsonDocument MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TBsonValue MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase&amp;lt;TBsonValue&amp;gt;.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TValue MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize&amp;lt;TValue&amp;gt;(IBsonSerializer&amp;lt;TValue&amp;gt; serializer, BsonDeserializationContext context)&lt;br/&gt;
   at BsonValue MongoDB.Bson.Serialization.Serializers.BsonValueSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TBsonValue MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase&amp;lt;TBsonValue&amp;gt;.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TValue MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize&amp;lt;TValue&amp;gt;(IBsonSerializer&amp;lt;TValue&amp;gt; serializer, BsonDeserializationContext context)&lt;br/&gt;
   at BsonDocument MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TBsonValue MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase&amp;lt;TBsonValue&amp;gt;.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TValue MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize&amp;lt;TValue&amp;gt;(IBsonSerializer&amp;lt;TValue&amp;gt; serializer, BsonDeserializationContext context)&lt;br/&gt;
   at BsonValue MongoDB.Bson.Serialization.Serializers.BsonValueSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TBsonValue MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase&amp;lt;TBsonValue&amp;gt;.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TValue MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize&amp;lt;TValue&amp;gt;(IBsonSerializer&amp;lt;TValue&amp;gt; serializer, BsonDeserializationContext context)&lt;br/&gt;
   at BsonDocument MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TBsonValue MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase&amp;lt;TBsonValue&amp;gt;.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TValue MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize&amp;lt;TValue&amp;gt;(IBsonSerializer&amp;lt;TValue&amp;gt; serializer, BsonDeserializationContext context)&lt;br/&gt;
   at ChangeStreamDocument&amp;lt;TDocument&amp;gt; MongoDB.Driver.ChangeStreamDocumentSerializer&amp;lt;TDocument&amp;gt;.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TValue MongoDB.Bson.Serialization.Serializers.SealedClassSerializerBase&amp;lt;TValue&amp;gt;.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
   at TValue MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize&amp;lt;TValue&amp;gt;(IBsonSerializer&amp;lt;TValue&amp;gt; serializer, BsonDeserializationContext context)&lt;br/&gt;
   at TDocument MongoDB.Driver.Core.Operations.ChangeStreamCursor&amp;lt;TDocument&amp;gt;.DeserializeDocument(RawBsonDocument rawDocument)&lt;br/&gt;
   at IEnumerable&amp;lt;TDocument&amp;gt; MongoDB.Driver.Core.Operations.ChangeStreamCursor&amp;lt;TDocument&amp;gt;.DeserializeDocuments(IEnumerable&amp;lt;RawBsonDocument&amp;gt; rawDocuments)&lt;br/&gt;
   at void MongoDB.Driver.Core.Operations.ChangeStreamCursor&amp;lt;TDocument&amp;gt;.ProcessBatch(bool hasMore)&lt;br/&gt;
   at async Task&amp;lt;bool&amp;gt; MongoDB.Driver.Core.Operations.ChangeStreamCursor&amp;lt;TDocument&amp;gt;.MoveNextAsync(CancellationToken cancellationToken)&lt;/p&gt;</description>
                <environment></environment>
        <key id="481640">CSHARP-2146</key>
            <summary>System.IO.EndOfStreamException when iterating change stream 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="9">Done</resolution>
                                        <assignee username="wan.bachtiar@mongodb.com">Wan Bachtiar</assignee>
                                    <reporter username="andrii.litvinov@gmail.com">Andrii Litvinov</reporter>
                        <labels>
                    </labels>
                <created>Thu, 11 Jan 2018 12:29:21 +0000</created>
                <updated>Tue, 4 Apr 2023 14:25:39 +0000</updated>
                            <resolved>Thu, 25 Jun 2020 02:28:07 +0000</resolved>
                                    <version>2.5</version>
                                                    <component>Connectivity</component>
                    <component>Read Operations</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3223180" author="rachelle.palmer" created="Thu, 25 Jun 2020 02:28:07 +0000"  >&lt;p&gt;Hi there, thank you for reaching out to MongoDB. As this sounds more like a support issue, I wanted to give you some resources to get this question answered more quickly:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;our MongoDB support portal, located at &lt;a href=&quot;https://support.mongodb.com/welcome&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;support.mongodb.com&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;our MongoDB community forums, located &lt;a href=&quot;https://developer.mongodb.com/community/forums/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;If you are an Atlas customer, there is free support offered 24/7 in the lower right hand corner of the UI.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Thank you!&lt;br/&gt;
Rachelle&lt;/p&gt;</comment>
                            <comment id="2216839" author="andrii.litvinov@gmail.com" created="Wed, 17 Apr 2019 18:14:14 +0000"  >&lt;p&gt;Hi Wan,&lt;/p&gt;

&lt;p&gt;Thank you for the comment. Replica set didn&apos;t fail over during the issue. The symptoms were that I started collection.watch and after some hours (days?) I got the exception that I posted in the description. After this exception my service tried to restart watching but then the error that you suggested happened (Command aggregate failed: The resume token UUID does not exist. Has the collection been dropped?). Could be that the service was watching for the collection for a long time and no changes happened to the collection for a time longer than the oplog window.&lt;/p&gt;

&lt;p&gt;I saw this exception multiple times during the testing of the service in staging environment, but I cannot provide steps to reproduce. Only thing that I can tell that the collections were not often modified and service was meant to be running without restart for extended period, like always.&lt;/p&gt;

&lt;p&gt;&amp;gt;Change Streams is built on top of oplog. If the last operation seen has fallen off the oplog, tailing oplog is essentially skipping some operations as well. i.e. similar to just calling Watch() without token.&lt;br/&gt;
The difference with tailing oplog is that I could start with the oldest operation and with change stream I could start only with the latest. That&apos;s why we decided to drop change stream implementation and are using oplog tailing up until now. That&apos;s why I cannot tell if the issue was fixed in 2.7 release.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br/&gt;
Andrii&lt;/p&gt;</comment>
                            <comment id="2209262" author="wan.bachtiar" created="Thu, 11 Apr 2019 06:23:29 +0000"  >&lt;blockquote&gt;&lt;p&gt;It seems that issue happened when there were no operations in oplog for the token I supplied&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Hi, &lt;/p&gt;

&lt;p&gt;If you call &lt;tt&gt;Collection.Watch()&lt;/tt&gt; (both in v2.5 and v2.7) with a resume token that no longer exists in the oplog, you should be getting &lt;tt&gt;MongoCommandException&lt;/tt&gt; with the following message, in MongoDB v3.6:&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;Unhandled Exception: System.AggregateException: One &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;or&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; more errors occurred. (Command aggregate failed: The resume token UUID does &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; exist. Has the collection been dropped?.) &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;-&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;-&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;-&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;&amp;gt; MongoDB.Driver.MongoCommandException: Command aggregate failed: The resume token UUID does &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; exist. Has the collection been dropped?.&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 you able to consistently reproduce the error ? If so, would you be able to provide:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Minimal and complete code snippets&lt;/li&gt;
	&lt;li&gt;Steps to reproduce the error&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Also, please test against MongoDB C# driver v2.7+&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;That&apos;s why I decided to change implementation of my service to oplog tailing instead of change stream&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/changeStreams/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Change Streams&lt;/a&gt; is built on top of oplog. If the last operation seen has fallen off the oplog, tailing oplog is essentially skipping some operations as well. i.e. similar to just calling &lt;tt&gt;Watch()&lt;/tt&gt; without token. &lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Based on the description of &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2267&quot; title=&quot;ChangeStream cursor raises resumable exception when there is no event since last replica set election&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2267&quot;&gt;&lt;del&gt;CSHARP-2267&lt;/del&gt;&lt;/a&gt; I believe it is. Just to be sure, after the fix, some different error will be thrown, right?&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The patch in &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2267&quot; title=&quot;ChangeStream cursor raises resumable exception when there is no event since last replica set election&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2267&quot;&gt;&lt;del&gt;CSHARP-2267&lt;/del&gt;&lt;/a&gt; is to ensure that &lt;tt&gt;getMore()&lt;/tt&gt; after an election is retried (This is actually not related to the use of resume token). Without knowing exactly how the issue you&apos;re having is triggered, it&apos;s difficult to conclude that this is the same issue. In v2.7.1+, &lt;tt&gt;Watch()&lt;/tt&gt; would be retryable without error after replica set failovers. &lt;/p&gt;

&lt;p&gt;Regards, &lt;br/&gt;
Wan.&lt;/p&gt;</comment>
                            <comment id="2130256" author="andrii.litvinov@gmail.com" created="Tue, 29 Jan 2019 08:13:04 +0000"  >&lt;p&gt;Hey Ian thank you getting back to me. It seems that issue happened when there were no operations in oplog for the token I supplied. Means I couldn&apos;t successfully resume the change stream and might miss new events. That&apos;s why I decided to change implementation of my service to oplog tailing instead of change stream. So I cannot confirm that the issue if fixed for me. Based on the description of&#160; &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2267&quot; title=&quot;ChangeStream cursor raises resumable exception when there is no event since last replica set election&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2267&quot;&gt;&lt;del&gt;CSHARP-2267&lt;/del&gt;&lt;/a&gt; I believe it is.&lt;/p&gt;

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

&lt;p&gt;Just to be sure, after the fix, some different error will be thrown, right?&lt;/p&gt;</comment>
                            <comment id="2129794" author="ian@10gen.com" created="Mon, 28 Jan 2019 20:35:11 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=Andrii+Litvinov&quot; class=&quot;user-hover&quot; rel=&quot;Andrii Litvinov&quot;&gt;Andrii Litvinov&lt;/a&gt; could you please test against 2.7.3?  Given that you were seeing this under 2.5, we believe we have fixed this issue since (see &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2267&quot; title=&quot;ChangeStream cursor raises resumable exception when there is no event since last replica set election&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2267&quot;&gt;&lt;del&gt;CSHARP-2267&lt;/del&gt;&lt;/a&gt;).&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                        <issuelink>
            <issuekey id="157252">CSHARP-1059</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="477392">SERVER-32496</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                    <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[500A000000aONxQIAW]]]></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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|htfb7b:</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>