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

can't make a connection when the Read Replica DB is in a hang state when SocketTimeout=0 set

    XMLWordPrintable

Details

    Description

      We are using Maria Driver 2.6.2 version to connect MariaDB and Aurora. For Aurora, we configured the primary DB and ReadOnly replica DB using the 'Aurora' keyword, while for MariaDB, we used the 'Replication' keyword for configuration.

      Here are the connection details we used:

      MariaDB:
      jdbc:mariadb:replication://primary1,replica1/test

      Aurora:
      jdbc:mariadb:aurora://primary1,replica1/test?SocketTimeout=0

      [Problem]
      We are experiencing issues when replica1 DB is under heavy load, causing the CPU usage to approach 100%. Even if replica1 DB is in an abnormal state, we expected the primary1 DB to be usable. However, the jdbc driver is unable to establish a connection and gets stuck in a hang state.

      [Trial 1]
      Setting connectTimeout does not resolve this problem.

      [Trial 2]
      Setting SocketTimeout to a shorter value could resolve this issue, but we need a very long query execution time, so SocketTimeout=0 is required.

      [Hang position]
      https://github.com/mariadb-corporation/mariadb-connector-j/blob/3021f01f1a8b28558f4083ec6b3feb6dea3ee665/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java#L540

      When attempting to create a connection, primary1 is successfully acquired, but replica1 gets stuck in a hang state as it does not receive a response in ReadInitialHandShakePacket(reader).

      [Request]
      We need a timeout for the process of establishing the connection, including the initialization settings after handshaking. This timeout should not be limited to TCP ConnectTimeout but should include the interval until the initialization settings are completed, as shown in the following section:
      https://github.com/mariadb-corporation/mariadb-connector-j/blob/3021f01f1a8b28558f4083ec6b3feb6dea3ee665/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java#L598"

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            heesung choi heesung
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.