<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:06 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-1260] Socket exceptions connecting to MongoDB </title>
                <link>https://jira.mongodb.org/browse/CSHARP-1260</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;We have implemented a MongoDB based output cache provider for a hybrid ASP.NET web forms / MVC application.&lt;/p&gt;

&lt;p&gt;The basic provider was modelled on this &lt;a href=&quot;https://msdn.microsoft.com/en-us/gg650661.aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://msdn.microsoft.com/en-us/gg650661.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We modified the code to use the official C# provider (see attached)&lt;/p&gt;

&lt;p&gt;Since deployment, we have seen a number of these exceptions:&lt;/p&gt;

&lt;p&gt;System.Net.Sockets.SocketException (0x80004005): 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;lt;IP ADDRESS&amp;gt;&amp;gt;:27017&lt;/p&gt;

&lt;p&gt;There are no obvious networking issues in our live environment. The MongoDB server is also currently the ASP.NET session state server.&lt;/p&gt;

&lt;p&gt;Any pointers as to how to debug / configuration to check?&lt;/p&gt;</description>
                <environment>Windows Web Server 2008 R2 (SP1)</environment>
        <key id="200703">CSHARP-1260</key>
            <summary>Socket exceptions connecting to MongoDB </summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="craig.wilson@mongodb.com">Craig Wilson</assignee>
                                    <reporter username="Embo1">Matthew Evans [X]</reporter>
                        <labels>
                            <label>question</label>
                    </labels>
                <created>Tue, 28 Apr 2015 07:56:46 +0000</created>
                <updated>Fri, 5 Apr 2019 13:59:17 +0000</updated>
                            <resolved>Wed, 13 May 2015 12:24:38 +0000</resolved>
                                    <version>1.9.2</version>
                                                    <component>Connectivity</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="912694" author="craiggwilson" created="Wed, 13 May 2015 12:32:51 +0000"  >&lt;p&gt;Thanks for the update Matthew.&lt;/p&gt;

&lt;p&gt;If you are using a replica set, then we&apos;ll ultimately use whatever is in the replica set configuration anyways (rs.config() from the shell). This means that, even if you change the app to use an IPAddress, if the replica set config is using a hostname, the driver will end up dropping the IPAddress and use the hostname.&lt;/p&gt;

&lt;p&gt;In addition, for portability, we always recommending using the fully qualified domain name, so I&apos;d suggest sticking with it and figuring out to rectify the DNS problems. Regardless, I&apos;m glad you figured it out. Please feel free to ping back if you see any further troubles.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="912558" author="embo1" created="Wed, 13 May 2015 08:49:49 +0000"  >&lt;p&gt;HI there,&lt;/p&gt;

&lt;p&gt;Please close this ticket. &lt;/p&gt;

&lt;p&gt;Network tracing indicated that we were having DNS resolution issues internally for our MongoDB server using the server name. Changing to the IP for the MongoServerAddress seems to have resolved the issue.&lt;/p&gt;

&lt;p&gt;Thanks for your help&lt;/p&gt;</comment>
                            <comment id="900682" author="embo1" created="Wed, 29 Apr 2015 07:32:56 +0000"  >&lt;p&gt;Hi Craig&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;

&lt;p&gt;We don&apos;t see similar issues with session state. We do sometimes see the following error in the log though&lt;/p&gt;

&lt;p&gt;The state server has closed an expired TCP/IP connection. The IP address of the client is 192.168.16.111. The expired Read operation began at 04/28/2015 12:55:13.&lt;/p&gt;

&lt;p&gt;Would you recommend installing the database on its own server? Rather than sharing resources with ASP.NET state service etc. &lt;/p&gt;

&lt;p&gt;1. We dont use a connection string as such. We connect using the following code:&lt;/p&gt;

&lt;p&gt;            MongoServerSettings settings = new MongoServerSettings &lt;/p&gt;
{ Server = new MongoServerAddress(Settings.Instance.Get(&quot;Caching.OutputCache&quot;, &quot;MongoDBName&quot;), 27017) }
&lt;p&gt;;&lt;br/&gt;
            MongoServer server = new MongoServer(settings);&lt;/p&gt;


&lt;p&gt;            MongoDatabase mongo = server.GetDatabase(&quot;OutputCacheDB&quot;);&lt;br/&gt;
            _cacheItems = mongo.GetCollection(&quot;CacheItems&quot;)&lt;/p&gt;

&lt;p&gt;Settings.Instance.Get(&quot;Caching.OutputCache&quot;, &quot;MongoDBName&quot;) returns the server name (&quot;sunset&quot;)&lt;/p&gt;

&lt;p&gt;Note no username and password. The server is not publicly accessible.&lt;/p&gt;

&lt;p&gt;2. This is currently a standalone instance.&lt;/p&gt;

&lt;p&gt;3. We have currently disabled the Mongo output cache and reverted to in memory. I will reimplement on on of the servers and see if we can get a trace for you.&lt;/p&gt;</comment>
                            <comment id="899679" author="craiggwilson" created="Tue, 28 Apr 2015 12:00:58 +0000"  >&lt;p&gt;Hi Matthew,&lt;/p&gt;

&lt;p&gt;Sorry you&apos;re having issues. Do you not see these problems with your session state?  A few other questions:&lt;/p&gt;

&lt;p&gt;1) What is your connection string?&lt;br/&gt;
2) What is your setup? Replica Set, standalone, etc...? If a replica set, could you provide the output of rs.config()?&lt;br/&gt;
3) Would it possible to get a network trace during one of the problems? &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/ty48b824%28v=vs.110%29.aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://msdn.microsoft.com/en-us/library/ty48b824%28v=vs.110%29.aspx&lt;/a&gt;.  Specifically, we care about System.Net.Sockets.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="72119" name="DocumentDatabaseOutputCacheProvider.cs" size="4681" author="Embo1" created="Tue, 28 Apr 2015 07:56:46 +0000"/>
                    </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|hs8tt3:</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>