Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-45136

Clarify SSL error instead of "HostUnreachable: Connection closed by peer"

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Shell
    • None
    • ALL
    • Security 2019-12-30

      I've wasted again a good amount of time due to an ambiguous error while trying to connect to my local MongoDB instance:

       

      $ mongo mongodb://127.0.0.1:8358
      MongoDB shell version v4.2.2
      connecting to: mongodb://127.0.0.1:8358/?compressors=disabled&gssapiServiceName=mongodb
      2019-12-13T14:18:45.894-0500 I  NETWORK  [js] DBClientConnection failed to receive message from 127.0.0.1:8358 - HostUnreachable: Connection closed by peer
      2019-12-13T14:18:45.894-0500 E  QUERY    [js] Error: network error while attempting to run command 'isMaster' on host '127.0.0.1:8358'  :
      connect@src/mongo/shell/mongo.js:341:17
      @(connect):2:6
      2019-12-13T14:18:45.896-0500 F  -        [main] exception: connect failed
      2019-12-13T14:18:45.896-0500 E  -        [main] exiting with code 1
      

      Initially I thought I got the port wrong, but replacing that with a random number yielded a different error, "connection attempt failed: SocketException: Error connecting to".

      I had to look in the server log to see the real error:

      Error receiving request from client: SSLHandshakeFailed: The server is configured to only allow SSL connections. Ending connection from 127.0.0.1:45476 (connection id: 1)

      That is what should have been displayed by the client.

            Assignee:
            spencer.jackson@mongodb.com Spencer Jackson
            Reporter:
            dandv Dan Dascalescu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: