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

Connection timeout issue due to DNS lookup

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • all
    • 1.5.4
    • Failover
    • None
    • 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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.