[CSHARP-738] Unable to connect to the server { }:27017 Created: 01/May/13 Updated: 20/Mar/14 Resolved: 13/Jun/13 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.8.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker - P1 |
| Reporter: | Harman | Assignee: | Craig Wilson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
I am getting this issue with latest C# driver version 1.8.1 frequently while I run even simple query on a large collection. However this does not generate in all cases and it works sometimes but fails sometimes which is really frustrating. The mongo server is on Amazon Ec2 ubuntu instance and .net app is on another EC2 server. Tried Sevres fixes like connectiontimeout,sockettimeout etc but not able to fix this. Unable to connect to the server ec2-143-39-225-37.us-west-1.compute.amazonaws.com:27017. Please help asap. |
| Comments |
| Comment by Craig Wilson [ 16/May/13 ] |
|
Harman, |
| Comment by Harman [ 16/May/13 ] |
|
Hi Craig Wilson I am using following code GetMongoConnection method public static MongoDatabase GetMongoConnection() { MongoServer mongo = new MongoClient(System.Configuration.ConfigurationManager.AppSettings["MongoServer"]).GetServer(); return mongo.GetDatabase(System.Configuration.ConfigurationManager.AppSettings["MongoDB"]); }I am not using disconnect in my code. |
| Comment by Craig Wilson [ 16/May/13 ] |
|
Harman,
Most importantly, are you ever calling Disconnect() in your code? Calling Disconnect from within your code can manifest itself as errors exactly like the ones you are describing. Thanks... |
| Comment by Harman [ 16/May/13 ] |
|
Hi @Robert Stam, I did not changed the or updated driver file.I just used C# version 1.8.1 official mongo driver from http://driver-downloads.mongodb.org/dotnet/index.html. |
| Comment by Robert Stam [ 08/May/13 ] |
|
Stack trace 2 seems impossible because line 115 of DirectMongoServerProxy.cs is not a throw statement. Are you building the driver yourself? Is it possible you have modified this file slightly so that the line numbers no longer match? |
| Comment by Harman [ 05/May/13 ] |
|
Hi @Robert Stam, yes stack trace is complete.Point 2 has same stack trace but with delete operation. I am getting two issues mainly.Issue 1 is mainly occurring too often. 1)Server instance ec2-132-112-112-150.us-west-1.compute.amazonaws.com:27017 is no longer connected. Stack Trace is : 2)Unable to connect to the server ec2-143-39-225-37.us-west-1.compute.amazonaws.com:27017. Stack Trace is: |
| Comment by Robert Stam [ 04/May/13 ] |
|
This looks like just a regular network connectivity issue. But I'm perplexed by your stack trace line numbers. Line 115 of DirectMongoServerProxy.cs does not throw an exception. It calls another method called Connect that isn't on your stack trace. Are you sure your stack trace is complete? |