[GODRIVER-1458] Connection to Mongo Cloud without +srv Created: 08/Jan/20  Updated: 22/Jan/20  Resolved: 22/Jan/20

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: safwan olaimat Assignee: Divjot Arora (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

i am trying to connect to mongodb cloud without +srv
the stucture of connection string
mongodb://username:password@seed1,seed2,seed3
error
panic: server selection error: server selection timeout, current topology: { Type: Unknown, Servers: [

{ Addr: ....:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : connection(...:27017[-179]) incomplete read of message header: EOF }

, { Addr: ....:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : connection(.....:27017[-180]) incomplete read of message header: EOF }, { Addr: .....:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : connection(.......:27017[-181]) incomplete read of message header: EOF }, ] }



 Comments   
Comment by Divjot Arora (Inactive) [ 22/Jan/20 ]

Hi safwan.olaimat@gmail.com,

Without any extra information or server logs, it's not possible for us to diagnose the issue. You mentioned that you were able to resolve the DNS issue and the SRV connection string should now work. We recommend using the SRV connection string anyway, as that's the most robust approach, so I'm going to close this ticket. Feel free to leave another comment if you still have issues.

Comment by safwan olaimat [ 21/Jan/20 ]

Hello @divjot Arora
sorry for late response
I was busy
now i have resolved the dns resolver issue just replace the nameserver from 127.0.0.53 to 8.8.8.8 should works with SRV
but i have no lucks to connection using master secondary connections string

Comment by Divjot Arora (Inactive) [ 13/Jan/20 ]

Hi safwan.olaimat@gmail.com,

I believe the issue is that the driver implicitly enables SSL for an SRV connection string, and Atlas servers are configured to only allow incoming connections over SSL. The smallest possible change would be to use a connection string like mongodb://username:password@seed1,seed2,seed3/?ssl=true. This would explicitly enable SSL in the driver.

Note that even though this may work, we still recommend using a connection string obtained directly from Atlas, as they may set extra parameters. As an example, I see that Atlas sets w=majority to enable write concern majority.

Comment by Divjot Arora (Inactive) [ 10/Jan/20 ]

safwan.olaimat@gmail.com If Atlas gives you a connection string with +srv, it is not valid to remove the +srv suffix. An SRV record is different from a hostname, as it can actually resolve to a list of hosts and the DNS server can also send back TXT records, which act as additional connection string parameters. In the list of drivers on the Atlas UI, if you click on "Python" and select "3.4 or later" for the version, Atlas should give you a URI that does not have +srv. Can you try this and see if it works for you?

Comment by safwan olaimat [ 09/Jan/20 ]

Hi @Divjot

yes the connection string from atlas
connecting with srv working fine on my machine
but on the server  there are problem with srv dns lookup
i have seeing comment that connection without  srv working with no problem
but no luck !

Comment by Divjot Arora (Inactive) [ 08/Jan/20 ]

Hi safwan.olaimat@gmail.com,

Is this a connection string provided by MongoDB Atlas? Was it originally an SRV connection string? The "incomplete read of message header: EOF" message indicates that the server is likely not accepting connections from the driver and this manifests as a network error on the driver side. If you have access to the server logs, there may be information there about why the server is not accepting these connections.

Generated at Thu Feb 08 08:36:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.