<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Thread leakage when connection cannot be established in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/thread-leakage-when-connection-cannot-be-established/m-p/39439#M26978</link>
    <description>&lt;P&gt;I suspect, that you have to call&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;TProtocol#getTransport().close()&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;in case of catching exception inside&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;HS2Client#&lt;/SPAN&gt;openSession();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;In this case you have also rewrite&amp;nbsp;TETHttpClient#close() in order to call ((ExtendedHttpClient)this.m_client).close(); in any cases.&lt;/P&gt;&lt;P&gt;After that my test started to work properly.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Aug 2023 13:06:19 GMT</pubDate>
    <dc:creator>krocodl</dc:creator>
    <dc:date>2023-08-09T13:06:19Z</dc:date>
    <item>
      <title>Thread leakage when connection cannot be established</title>
      <link>https://community.databricks.com/t5/data-engineering/thread-leakage-when-connection-cannot-be-established/m-p/39435#M26976</link>
      <description>&lt;P&gt;During the execution of the next code we can observe&amp;nbsp;a lost thread that will never end:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;@Test&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;public void &lt;/SPAN&gt;&lt;SPAN&gt;pureConnectionErrorTest&lt;/SPAN&gt;() &lt;SPAN&gt;throws &lt;/SPAN&gt;&lt;SPAN&gt;Exception &lt;/SPAN&gt;{&lt;BR /&gt;    &lt;SPAN&gt;try &lt;/SPAN&gt;{&lt;BR /&gt;        &lt;SPAN&gt;DriverManager&lt;/SPAN&gt;.&lt;SPAN&gt;getConnection&lt;/SPAN&gt;(&lt;SPAN&gt;DATABRICKS_JDBC_URL&lt;/SPAN&gt;, &lt;SPAN&gt;DATABRICKS_USERNAME&lt;/SPAN&gt;, &lt;SPAN&gt;DATABRICKS_PASSWORD &lt;/SPAN&gt;+ &lt;SPAN&gt;"!"&lt;/SPAN&gt;);&lt;BR /&gt;        &lt;SPAN&gt;fail&lt;/SPAN&gt;();&lt;BR /&gt;    } &lt;SPAN&gt;catch &lt;/SPAN&gt;(&lt;SPAN&gt;Exception &lt;/SPAN&gt;ex) {&lt;BR /&gt;        &lt;SPAN&gt;// it is normal&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;BR /&gt;    &lt;SPAN&gt;while&lt;/SPAN&gt;(&lt;SPAN&gt;true&lt;/SPAN&gt;) {&lt;BR /&gt;        &lt;SPAN&gt;Thread&lt;/SPAN&gt;.&lt;SPAN&gt;sleep&lt;/SPAN&gt;(&lt;SPAN&gt;1000&lt;/SPAN&gt;);&lt;BR /&gt;        &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"."&lt;/SPAN&gt;);&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;This thread looks like the next:&lt;/P&gt;&lt;P&gt;"Connection evictor" #18 daemon prio=5 os_prio=31 cpu=0.10ms elapsed=7.05s tid=0x00007f9bd0925c00 nid=0x9603 waiting on condition [0x000000030ef7d000]&lt;BR /&gt;java.lang.Thread.State: TIMED_WAITING (sleeping)&lt;BR /&gt;at java.lang.Thread.sleep(java.base@17.0.3/Native Method)&lt;BR /&gt;at com.databricks.client.jdbc42.internal.apache.http.impl.client.IdleConnectionEvictor$1.run(IdleConnectionEvictor.java:66)&lt;BR /&gt;at java.lang.Thread.run(java.base@17.0.3/Thread.java:833)&lt;/P&gt;&lt;P&gt;It is lost, because method IdleConnectionEvictor#shutdown was not called.&lt;/P&gt;&lt;P&gt;Root exception:&lt;/P&gt;&lt;P&gt;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.&lt;BR /&gt;... 85 common frames omitted&lt;BR /&gt;Caused by: com.databricks.client.jdbc42.internal.apache.thrift.transport.TTransportException: HTTP Response code: 403, Error message: Unknown&lt;BR /&gt;at com.databricks.client.hivecommon.api.TETHttpClient.handleHeaderErrorMessage(Unknown Source)&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 10:41:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/thread-leakage-when-connection-cannot-be-established/m-p/39435#M26976</guid>
      <dc:creator>krocodl</dc:creator>
      <dc:date>2023-08-09T10:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Thread leakage when connection cannot be established</title>
      <link>https://community.databricks.com/t5/data-engineering/thread-leakage-when-connection-cannot-be-established/m-p/39439#M26978</link>
      <description>&lt;P&gt;I suspect, that you have to call&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;TProtocol#getTransport().close()&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;in case of catching exception inside&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;HS2Client#&lt;/SPAN&gt;openSession();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;In this case you have also rewrite&amp;nbsp;TETHttpClient#close() in order to call ((ExtendedHttpClient)this.m_client).close(); in any cases.&lt;/P&gt;&lt;P&gt;After that my test started to work properly.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 13:06:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/thread-leakage-when-connection-cannot-be-established/m-p/39439#M26978</guid>
      <dc:creator>krocodl</dc:creator>
      <dc:date>2023-08-09T13:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Thread leakage when connection cannot be established</title>
      <link>https://community.databricks.com/t5/data-engineering/thread-leakage-when-connection-cannot-be-established/m-p/57545#M30819</link>
      <description>&lt;P&gt;This issue is reported as fixed since&amp;nbsp;&lt;SPAN&gt;v2.6.34. I validated version&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;2.6.36&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;- it works normal.&amp;nbsp;Many thanks to the developers for the work done!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 08:28:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/thread-leakage-when-connection-cannot-be-established/m-p/57545#M30819</guid>
      <dc:creator>krocodl</dc:creator>
      <dc:date>2024-01-17T08:28:45Z</dc:date>
    </item>
  </channel>
</rss>

