During the execution of the next code we can observe a lost thread that will never end:
@Test
public void pureConnectionErrorTest() throws Exception {
try {
DriverManager.getConnection(DATABRICKS_JDBC_URL, DATABRICKS_USERNAME, DATABRICKS_PASSWORD + "!");
fail();
} catch (Exception ex) {
// it is normal
}
while(true) {
Thread.sleep(1000);
System.out.println(".");
}
}
This thread looks like the next:
"Connection evictor" #18 daemon prio=5 os_prio=31 cpu=0.10ms elapsed=7.05s tid=0x00007f9bd0925c00 nid=0x9603 waiting on condition [0x000000030ef7d000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(java.base@17.0.3/Native Method)
at com.databricks.client.jdbc42.internal.apache.http.impl.client.IdleConnectionEvictor$1.run(IdleConnectionEvictor.java:66)
at java.lang.Thread.run(java.base@17.0.3/Thread.java:833)
It is lost, because method IdleConnectionEvictor#shutdown was not called.
Root exception:
Caused by: com.databricks.client.support.exceptions.ErrorException: [Databricks][DatabricksJDBCDriver](500593) Communication link failure. Failed to connect to server. Reason: HTTP Response code: 403, Error message: Unknown.
... 85 common frames omitted
Caused by: com.databricks.client.jdbc42.internal.apache.thrift.transport.TTransportException: HTTP Response code: 403, Error message: Unknown
at com.databricks.client.hivecommon.api.TETHttpClient.handleHeaderErrorMessage(Unknown Source)