openinx opened a new pull request #1433:
URL: https://github.com/apache/iceberg/pull/1433


   When preparing demo for flink + hive metastore,   I created a hive catalog 
with a random port for metastore, for example: 
   
   ```sql
   create catalog hive_catalog with(
     'type'='iceberg',
     'catalog-type'='hive',
     'uri'='thrift://localhost:3234',
     'clients'='1',
     'property-version'='1'
   );
   ```
   
   Then I switch to use the `hive_catalog` and execute sql command `show 
databases` to show all the databases,  I found that the sql command was 
blocked. 
   
   After digging into the code, I find that it's a bug in `ClientPool`, saying 
if encountering an exception when `newClient`,  the upper layer (Flink SQL 
client) will try to close all the resources from `ClientPool` by calling 
`ClientPool#close`, finally it will be blocked in close method like following: 
   
   ```
   "main" #1 prio=5 os_prio=31 tid=0x00007fc853802800 nid=0x1d03 in 
Object.wait() [0x000070000ad92000]
      java.lang.Thread.State: TIMED_WAITING (on object monitor)
           at java.lang.Object.wait(Native Method)
           at org.apache.iceberg.hive.ClientPool.close(ClientPool.java:110)
           - locked <0x0000000771b203c8> (a java.lang.Object)
           at org.apache.iceberg.hive.HiveCatalog.close(HiveCatalog.java:480)
           at org.apache.iceberg.flink.FlinkCatalog.close(FlinkCatalog.java:120)
           at 
org.apache.flink.table.client.gateway.local.ExecutionContext$$Lambda$503/1760443245.accept(Unknown
 Source)
           at java.util.HashMap$Values.forEach(HashMap.java:981)
           at 
org.apache.flink.table.client.gateway.local.ExecutionContext.lambda$close$2(ExecutionContext.java:307)
           at 
org.apache.flink.table.client.gateway.local.ExecutionContext$$Lambda$500/1972628089.run(Unknown
 Source)
           at 
org.apache.flink.table.client.gateway.local.ExecutionContext.wrapClassLoader(ExecutionContext.java:264)
           at 
org.apache.flink.table.client.gateway.local.ExecutionContext.close(ExecutionContext.java:307)
           at 
org.apache.flink.table.client.gateway.local.LocalExecutor.closeSession(LocalExecutor.java:244)
           at org.apache.flink.table.client.SqlClient.start(SqlClient.java:116)
           at org.apache.flink.table.client.SqlClient.main(SqlClient.java:201)
   ```
   
   The patch fixed this bug and attached an unit test to reproduce the case. 
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to