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

Connection hanging when using a CNAME aurora endpoint with authentication

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 2.5.3, 2.5.4
    • Fix Version/s: N/A
    • Component/s: aurora
    • Labels:
      None

      Description

      There has been a regression in 2.5.3 following this commit for our use case.

      Test setup :

      • One aurora instance (version doesn't matter). For the example let's say the cluster endpoint is "aurora-cluster.aws.com"
      • One CNAME record (can be in /etc/hosts or a real record) "cname.test.com" -> "aurora-cluster.aws.com". This could also be a A record to the cluster IP.

      Code setup (this will work) :

      java.util.Properties info = new java.util.Properties();
      info.put("user", "anythingValid");
      info.put("password", "anythingValid");
      return new Driver().connect("aurora-cluster.aws.com", info);
      

      Code setup (this will not work) :

      java.util.Properties info = new java.util.Properties();
      info.put("user", "anythingValid");
      info.put("password", "anythingValid");
      return new Driver().connect("cname.test.com", info);
      

      I've dug a bit into it and the difference lies in UrlParser::auroraPipelineQuirks where the pipeline auth is disabled for the cluster endpoint since it's matching the aurora regex while the CNAME record is obviously not doing that. Seems like sending that extra byte made some difference at some level though for this part I'm not that familiar with the inner working of the driver.

      There's definitely some timing issues here because when I was debugging, I was able to successfully connect sometimes. When running the code with no breakpoints, I always reproduced the issue.

      here is the stack trace when the thread is stuck :

      owns: ReadAheadBufferedStream  (id=23)	
      SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method]	
      SocketInputStream.socketRead(FileDescriptor, byte[], int, int, int) line: 116	
      SocketInputStream.read(byte[], int, int, int) line: 171	
      SocketInputStream.read(byte[], int, int) line: 141	
      ReadAheadBufferedStream(FilterInputStream).read(byte[], int, int) line: 133	
      ReadAheadBufferedStream.fillBuffer(int) line: 129	
      ReadAheadBufferedStream.read(byte[], int, int) line: 102	
      StandardPacketInputStream.getPacketArray(boolean) line: 241	
      StandardPacketInputStream.getPacket(boolean) line: 212	
      MasterProtocol(AbstractQueryProtocol).readPacket(Results) line: 1443	
      MasterProtocol(AbstractQueryProtocol).getResult(Results) line: 1424	
      MasterProtocol(AbstractConnectProtocol).readRequestSessionVariables(Map<String,String>) line: 884	
      MasterProtocol(AbstractConnectProtocol).readPipelineAdditionalData(Map<String,String>) line: 929	
      MasterProtocol(AbstractConnectProtocol).postConnectionQueries() line: 793	
      MasterProtocol(AbstractConnectProtocol).createConnection(HostAddress, String) line: 549	
      MasterProtocol(AbstractConnectProtocol).connectWithoutProxy() line: 1236	
      Utils.retrieveProxy(UrlParser, GlobalStateInfo) line: 610	
      MariaDbConnection.newConnection(UrlParser, GlobalStateInfo) line: 142	
      Driver.connect(String, Properties) line: 86	
      

      Happy to provide more info if necessary, thx!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              diego dupin Diego Dupin
              Reporter:
              jebeaudet Jacques-Etienne Beaudet
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: