[ https://issues.apache.org/jira/browse/HIVE-25971?focusedWorklogId=732136&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-732136 ]
ASF GitHub Bot logged work on HIVE-25971: ----------------------------------------- Author: ASF GitHub Bot Created on: 24/Feb/22 05:39 Start Date: 24/Feb/22 05:39 Worklog Time Spent: 10m Work Description: 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 732136) Time Spent: 0.5h (was: 20m) > Tez task shutdown getting delayed due to cached thread pool not closed > ---------------------------------------------------------------------- > > Key: HIVE-25971 > URL: https://issues.apache.org/jira/browse/HIVE-25971 > Project: Hive > Issue Type: Improvement > Components: Tez > Affects Versions: 2.4.0, 3.1.2 > Reporter: Shailesh Gupta > Assignee: Shailesh Gupta > Priority: Minor > Labels: pull-request-available > Time Spent: 0.5h > Remaining Estimate: 0h > > We are using > a[CachedThreadPool|https://github.com/apache/hive/blob/branch-2.3/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java] > but not closing it. CachedThreadPool creates non daemon threads, causing the > Tez Task JVM shutdown delayed upto 1 min, as default idle timeout is 1 min. > -- This message was sent by Atlassian Jira (v8.20.1#820001)