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

'Address family not supported by protocol' depending on the way used to disable IPv6

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 4.3 Desired
    • Component/s: Networking
    • Labels:
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Using a configuration file with 

      net:  
        ipv6: true
      

      disabling IPv6 in the system by running

      sudo sysctl -w net.ipv6.conf.*.disable_ipv6=1

      it works fine, but disabling it passing 

      ipv6.disable=1

      as a bootarg to the Linux kernel, we obtain the 
       

      2019-06-21T14:09:17.995+0000 I STORAGE [initandlisten] exception in initAndListen std::exception: open: Address family not supported by protocol, terminating 
      

      error message in the logs and the service doesn't run.

      Show
      Using a configuration file with  net:  ipv6: true disabling IPv6 in the system by running sudo sysctl -w net.ipv6.conf.*.disable_ipv6= 1 it works fine, but disabling it passing  ipv6.disable= 1 as a bootarg to the Linux kernel, we obtain the    2019 - 06 -21T14: 09 : 17.995 + 0000 I STORAGE [initandlisten] exception in initAndListen std::exception: open: Address family not supported by protocol, terminating  error message in the logs and the service doesn't run.
    • Sprint:
      Service Arch 2019-10-07, Service Arch 2019-10-21

      Description

      Tested on k8s by setting the ipv6 parameter to true or false in the mongodb.conf file:

      # network interfaces
      net:
        port: 27017
        unixDomainSocket:
          enabled: true
          pathPrefix: /opt/bitnami/mongodb/tmp
        ipv6: true
        bindIpAll: true

       

      In some k8s cluster, mongodb service is not running because of the following error (from mongodb.log):

      2019-06-21T14:09:17.987+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
      2019-06-21T14:09:17.992+0000 I CONTROL [initandlisten] MongoDB starting : pid=36 port=27017 dbpath=/opt/bitnami/mongodb/data/db 64-bit host=carlosrh-mongo-mongodb-76bc884646-ztpxl
      2019-06-21T14:09:17.992+0000 I CONTROL [initandlisten] db version v4.0.10
      2019-06-21T14:09:17.992+0000 I CONTROL [initandlisten] git version: c389e7f69f637f7a1ac3cc9fae843b635f20b766
      2019-06-21T14:09:17.992+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.0j 20 Nov 2018
      2019-06-21T14:09:17.992+0000 I CONTROL [initandlisten] allocator: tcmalloc
      2019-06-21T14:09:17.992+0000 I CONTROL [initandlisten] modules: none
      2019-06-21T14:09:17.992+0000 I CONTROL [initandlisten] build environment:
      2019-06-21T14:09:17.992+0000 I CONTROL [initandlisten] distmod: debian92
      2019-06-21T14:09:17.992+0000 I CONTROL [initandlisten] distarch: x86_64
      2019-06-21T14:09:17.992+0000 I CONTROL [initandlisten] target_arch: x86_64
      2019-06-21T14:09:17.993+0000 I CONTROL [initandlisten] options: { config: "/opt/bitnami/mongodb/conf/mongodb.conf", net: { bindIpAll: true, ipv6: true, port: 27017, unixDomainSocket: { enabled: true, pathPrefix: "/opt/bitnami/mongodb/tmp" } }, processManagement: { fork: false, pidFilePath: "/opt/bitnami/mongodb/tmp/mongodb.pid" }, security: { authorization: "disabled" }, setParameter: { enableLocalhostAuthBypass: "true" }, storage: { dbPath: "/opt/bitnami/mongodb/data/db", directoryPerDB: false, journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, logRotate: "reopen", path: "/opt/bitnami/mongodb/logs/mongodb.log", quiet: false, verbosity: 0 } }
      2019-06-21T14:09:17.995+0000 I STORAGE [initandlisten] exception in initAndListen std::exception: open: Address family not supported by protocol, terminating
      2019-06-21T14:09:17.996+0000 I CONTROL [initandlisten] now exiting
      2019-06-21T14:09:17.996+0000 I CONTROL [initandlisten] shutting down with code:100

      This message is very descriptive:

      2019-06-21T14:09:17.995+0000 I STORAGE [initandlisten] exception in initAndListen std::exception: open: Address family not supported by protocol, terminating

       

      Although the host has disabled IPv6, it is expected that MongoDB will try to use IPv4 in its absence, in fact, we tried it when using this parameter for the first time, so why in some k8s cluster works and not in others?

      We can disable IPv6 support by running

      sudo sysctl -w net.ipv6.conf.*.disable_ipv6=1

      in this case, mongodb server does not complain about unsupported address family when IPv6 is enabled in the configs. This reflects with our earlier findings as we had used the same method to disable IPv6.

       

      Continuing on our investigation, we found that the alternate way of disabling IPv6 support is to pass

      ipv6.disable=1

      as a bootarg to the Linux kernel and with this, we were able to see the unsupported address family error with mongodb.

      With these findings, we cannot make the assumption that IPv6 enabled in the mongodb configs by default will always work regardless of whether the underlying host supports IPv6 or not.

       

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: