Michal Klempa created HIVE-15658: ------------------------------------ Summary: hive.ql.session.SessionState start() is not atomic, SessionState thread local variable can get into inconsistent state Key: HIVE-15658 URL: https://issues.apache.org/jira/browse/HIVE-15658 Project: Hive Issue Type: Bug Components: API, HCatalog Affects Versions: 2.0.1, 2.0.0, 1.2.1, 1.1.0 Environment: CDH5.8.0, Flume 1.6.0, Hive 1.1.0 Reporter: Michal Klempa
Method start() in hive.ql.session.SessionState is supposed to setup needed preconditions, like HDFS scratch directories for session. This happens to be not an atomic operation with setting thread local variable, which can later be obtained by calling SessionState.get(). Therefore, even is the start() method itself fails, the SessionState.get() does not return null and further re-use of the thread which previously invoked start() may lead to obtaining SessionState object in inconsistent state. I have observed this using Flume Hive Sink, which uses Hive Streaming interface. When the directory /tmp/hive is not writable by session user, the start() method fails (throwing RuntimeException). If the thread is re-used (like it is in Flume), further executions work with wrongly initialized SessionState object (HDFS dirs are non-existent). Steps to reproduce: 1. hdfs dfs -chmod 600 /tmp/hive 2. create Flume First -- This message was sent by Atlassian JIRA (v6.3.4#6332)