[ https://issues.apache.org/jira/browse/HIVE-14739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15485740#comment-15485740 ]
Prasanth Jayachandran commented on HIVE-14739: ---------------------------------------------- Thanks [~cnauroth] for reviewing the patch! I am not sure why ShutdownHookManager was forked initially (probably it was private initially in hadoop not sure though). I looked at the history and the initial commit didn't have any intent to fork it. But then later HIVE-11768 added delete on exit hook that manages the temp files that are created to be cleared on shutdown. I refactored the hive's ShutdownHookManger to retain the DELETE_ON_EXIT hook and retain some methods that will just delegate to Hadoop's ShutdownHookManager. Also replaced all Threads with Runnable. > Replace runnables directly added to runtime shutdown hooks to avoid deadlock > ---------------------------------------------------------------------------- > > Key: HIVE-14739 > URL: https://issues.apache.org/jira/browse/HIVE-14739 > Project: Hive > Issue Type: Bug > Affects Versions: 2.2.0 > Reporter: Deepesh Khandelwal > Assignee: Prasanth Jayachandran > Attachments: HIVE-14739.1.patch, HIVE-14739.2.patch > > > [~deepesh] reported that a deadlock can occur when running queries through > hive cli. [~cnauroth] analyzed it and reported that hive adds shutdown hooks > directly to java Runtime which may execute in non-deterministic order causing > deadlocks with hadoop's shutdown hooks. In one case, hadoop shutdown locked > FileSystem#Cache and FileSystem.close whereas hive shutdown hook locked > FileSystem.close and FileSystem#Cache order causing a deadlock. > Hive and Hadoop has ShutdownHookManager that runs the shutdown hooks in > deterministic order based on priority. We should use that to avoid deadlock > throughout the code. -- This message was sent by Atlassian JIRA (v6.3.4#6332)