<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:32 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-343] .Net Web App via C# driver reports connection problems</title>
                <link>https://jira.mongodb.org/browse/CSHARP-343</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Two symptoms, potentially linked:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Specific server in a farm of identical machines generates errors, apparently one per second It is logged Via elmah as:&lt;br/&gt;
System.TimeoutException: Timeout waiting for a MongoConnection.&lt;br/&gt;
   at MongoDB.Driver.Internal.MongoConnectionPool.AcquireConnection(MongoDatabase database)&lt;br/&gt;
   at MongoDB.Driver.MongoServerInstance.AcquireConnection(MongoDatabase database)&lt;br/&gt;
   at MongoDB.Driver.MongoServer.AcquireConnection(MongoDatabase database, Boolean slaveOk)&lt;br/&gt;
   at MongoDB.Driver.MongoCursorEnumerator`1.AcquireConnection()&lt;br/&gt;
   at MongoDB.Driver.MongoCursorEnumerator`1.GetFirst()&lt;br/&gt;
   at MongoDB.Driver.MongoCursorEnumerator`1.MoveNext()&lt;br/&gt;
   at System.Linq.Enumerable.FirstOrDefault&lt;span class=&quot;error&quot;&gt;&amp;#91;TSource&amp;#93;&lt;/span&gt;(IEnumerable`1 source)&lt;br/&gt;
   at MongoDB.Driver.MongoCollection.FindOneAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(IMongoQuery query)&lt;br/&gt;
   at MongoDB.Driver.MongoCollection`1.FindOne(IMongoQuery query)&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.RunCommandAs(Type commandResultType, IMongoCommand command)&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.RunCommandAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TCommandResult&amp;#93;&lt;/span&gt;(IMongoCommand command)&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.RunCommand(IMongoCommand command)&lt;br/&gt;
   at MongoDB.Driver.MongoCollection.Count(IMongoQuery query)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This is resolved by resetting the app-pool for that site on that host. No specific trigger is found on the servers themselves in either the mongodb.log files nor from other system monitoring tools.&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Some time later (30 minutes)all servers in the pool (of 6) begin logging:&lt;br/&gt;
System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---&amp;gt; System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond&lt;br/&gt;
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
	&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
		&lt;li&gt;
		&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
			&lt;li&gt;End of inner exception stack trace &amp;#8212;&lt;br/&gt;
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)&lt;br/&gt;
   at MongoDB.Bson.IO.BsonBuffer.LoadFrom(Stream stream, Int32 count)&lt;br/&gt;
   at MongoDB.Bson.IO.BsonBuffer.LoadFrom(Stream stream)&lt;br/&gt;
   at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(BsonBinaryReaderSettings readerSettings, IBsonSerializationOptions serializationOptions)&lt;br/&gt;
   at MongoDB.Driver.MongoCursorEnumerator`1.GetReply(MongoConnection connection, MongoRequestMessage message)&lt;br/&gt;
   at MongoDB.Driver.MongoCursorEnumerator`1.GetFirst()&lt;br/&gt;
   at MongoDB.Driver.MongoCursorEnumerator`1.MoveNext()&lt;br/&gt;
   at System.Linq.Enumerable.FirstOrDefault&lt;span class=&quot;error&quot;&gt;&amp;#91;TSource&amp;#93;&lt;/span&gt;(IEnumerable`1 source)&lt;br/&gt;
   at MongoDB.Driver.MongoCollection.FindOneAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(IMongoQuery query)&lt;br/&gt;
   at MongoDB.Driver.MongoCollection`1.FindOne(IMongoQuery query)&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.RunCommandAs(Type commandResultType, IMongoCommand command)&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.RunCommandAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TCommandResult&amp;#93;&lt;/span&gt;(IMongoCommand command)&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.RunCommand(IMongoCommand command)&lt;br/&gt;
   at MongoDB.Driver.MongoCollection.Count(IMongoQuery query)&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This is again resolved by an app-pool reset. &lt;/p&gt;

&lt;p&gt;In both cases the evidence points more to the driver, however we would like to know how to go about directing ourselves in one direction or another. A problem local to one server doesn&apos;t feel like a server issues, however a problem shared among several could be.&lt;/p&gt;</description>
                <environment>Windows Server 2008R2 Datacenter (EC2) running IIS7</environment>
        <key id="23768">CSHARP-343</key>
            <summary>.Net Web App via C# driver reports connection problems</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="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="dpinkard@woot.com">Dan Pinkard</reporter>
                        <labels>
                            <label>driver</label>
                    </labels>
                <created>Tue, 18 Oct 2011 18:22:35 +0000</created>
                <updated>Thu, 2 Apr 2015 18:28:35 +0000</updated>
                            <resolved>Mon, 20 Feb 2012 03:21:44 +0000</resolved>
                                    <version>1.1</version>
                                    <fixVersion>1.3.1</fixVersion>
                                                        <votes>1</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="95535" author="rstam" created="Mon, 5 Mar 2012 21:38:42 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-406&quot; title=&quot;Deadlock and TimeoutException when acquiring connection.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-406&quot;&gt;&lt;del&gt;CSHARP-406&lt;/del&gt;&lt;/a&gt; fixes the most likely cause for seeing this exception. Note that under heavy loads you might still see this exception.&lt;/p&gt;</comment>
                            <comment id="89986" author="rstam" created="Mon, 20 Feb 2012 03:21:26 +0000"  >&lt;p&gt;The &quot;Timeout waiting for a MongoConnection&quot; could happen after time due to a bug in the 1.2 version of the driver.&lt;/p&gt;

&lt;p&gt;The IOException is caused by a timeout waiting for a response from the server. The default timeout is 30 seconds, so if you are getting timeouts it means some queries are taking longer than 30 seconds. I have also seen this exception happen when you configure the socketTimeout to a value that is too short.&lt;/p&gt;

&lt;p&gt;I am closing this issue because I believe that it only affects version 1.2 and not the latest version of the driver.&lt;/p&gt;</comment>
                            <comment id="61710" author="dpinkard@woot.com" created="Thu, 20 Oct 2011 22:42:50 +0000"  >&lt;p&gt;Correction: We are on the 1.2 driver.&lt;/p&gt;</comment>
                            <comment id="61229" author="dpinkard@woot.com" created="Tue, 18 Oct 2011 19:33:58 +0000"  >&lt;p&gt;Will investigate moving up to 1.2. We are using the default connection pool size, however I am not sure how many threads are drawing from it. &lt;/p&gt;

&lt;p&gt;It would be nice for the driver and/or application can bubble up the IP of the offending server(s), but I&apos;m not sure who is dropping that at the moment. &lt;/p&gt;</comment>
                            <comment id="61210" author="rstam" created="Tue, 18 Oct 2011 18:41:31 +0000"  >&lt;p&gt;v1.1 of the C# driver is one release back. Any chance you could upgrade to v1.2?&lt;/p&gt;

&lt;p&gt;Both exceptions are symptoms of the server not responding quickly enough.&lt;/p&gt;

&lt;p&gt;The first exception occurs because the driver times out waiting for a connection from the connection pool. How many threads do you have? When queries are slow then connections are also slow to be returned to the connection pool, which can lead to this exception. The default connection pool size is 100.&lt;/p&gt;

&lt;p&gt;The second exception occurs when the driver does not receive a response from the server within the timeout period (default is 30 seconds).&lt;/p&gt;

&lt;p&gt;I can&apos;t tell from the exceptions alone whether the driver has any role to play in the poor performance or not. v1.1 of the driver did have a negative feedback loop where once errors started occurring they got worse (see &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-302&quot; title=&quot;Frequent connection errors result in a Connect/Disconnect storm&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-302&quot;&gt;&lt;del&gt;CSHARP-302&lt;/del&gt;&lt;/a&gt;). What you would see in the server log is lots of messages reporting that connections are being opened and closed.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="32116">CSHARP-406</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrh8a7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14141</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>