guptashailesh92 commented on pull request #3046: URL: https://github.com/apache/hive/pull/3046#issuecomment-1049512701
In case of [CacheThreadPool](https://github.com/apache/hive/blob/7b7e8d4d7910b9b6dc2fe498a6a4228c628853c1/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java#L59), keepAliveTime is set to 60 sec. So allowCoreThreadTimeOut is false only but it waits for the task in the [queue](https://github.com/openjdk/jdk/blob/a6610031e2816156fa14876457e260282a88d478/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java#L1061) for keepAlivetime, if not found then it sets timedOut = true, which leds to thread being destroyed. For the cached thread pool, all threads are non-daemon threads, but shutdown hook is not called until all the non-daemon threads are destroyed. I had pasted logs , where I wrote a custom code, for printing shutdown hooks and I made sure its last line to execute. We can see the time difference (10 sec) between shutdown hook being called and last line code. The time difference can be upto 1 min. I have observed till 45 secs. ``` 2022-02-03 16:47:54,432 [INFO] [main] |util.Debug|: Hook: class org.apache.hadoop.hive.ql.exec.tez.ObjectCache$2 2022-02-03 16:48:04,079 [DEBUG] [Thread-4] |util.ShutdownHookManager|: Completed shutdown in 0.001 seconds; Timeouts: 0 2022-02-03 16:48:04,088 [DEBUG] [Thread-4] |util.ShutdownHookManager|: ShutdownHookManger completed shutdown. ``` -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
