Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-360

Connection timeout issue due to DNS lookup

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: all
    • Fix Version/s: 1.5.4
    • Component/s: Failover
    • Labels:
      None
    • Environment:
      Mac OS 10.12 Sierra, Netbeans 8.1/8.2

      Description

      There is a problem to establish connection to Mariadb using java connector. DriverManager.getConnection returns an exception java.sql.SQLNonTransientConnectionException: Could not connect to 'db server ip':3306: unexpected end of stream, read 0 bytes from 4. This error occurs only with Mac os Sierra.
      I have no firewall or anti virus software launched.
      I found found that importing mysql-connector to the project solves the problem, even if I load a mariadb driver (Class.forName("org.mariadb.jdbc.Driver").newInstance()

      Edit:
      After investigation, problem rely on use of ManagementFactory.getRuntimeMXBean().getName() to get process PID. Java execute a DNS query to get hostname. If DNS isn't well configured on server, DNS request may take more time than server permit, and server will close socket. New implementation rely on JNA if present to avoid this problem

        Attachments

        1. mariadbException.pcapng
          12 kB
          Lukasz Strzeszkowski
        2. ubuntu14_04LTS_log.txt
          12 kB
          Lukasz Strzeszkowski
        3. ubuntu16_04LTS_log.txt
          12 kB
          Lukasz Strzeszkowski

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            Strzeszku Lukasz Strzeszkowski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration