TimurRakhmatullin86 opened a new pull request, #6823:
URL: https://github.com/apache/hive/pull/6823

   ## Summary
   
   When catching `InterruptedException`, the JVM clears the interrupt flag on 
the current thread. Per Java concurrency best practices (see *Java Concurrency 
in Practice*, Section 7.1.3), any code that catches `InterruptedException` and 
does not re-throw it must restore the interrupt status by calling 
`Thread.currentThread().interrupt()`. Failing to do so silently swallows the 
interrupt signal, preventing upstream callers and thread-pool executors from 
detecting that an interrupt occurred.
   
   This patch adds `Thread.currentThread().interrupt()` to **26 files** across 
the `ql` and `standalone-metastore` modules where the interrupt status was 
being silently consumed.
   
   ## Affected Components
   
   - **Query execution**: `ScriptOperator`, `Utilities`, `HadoopJobExecHelper`, 
`JobDebugger`, `ReplDumpTask`
   - **Tez integration**: `KillMoveTriggerActionHandler`, `WorkloadManager`
   - **Lock management**: `DbLockManager`, `DbTxnManager`, 
`EmbeddedLockManager`, `ZooKeeperHiveLockManager`
   - **Transaction & compaction**: `CompactorUtil`
   - **Replication**: `CopyUtils`
   - **Statistics**: `BasicStatsTask`
   - **Optimizer**: `NullScanTaskDispatcher`
   - **Hooks**: `HiveProtoLoggingHook`
   - **Retry utilities**: `Retryable`, `RetryingExecutor`
   - **Metastore client**: `ThriftHiveMetaStoreClient`
   - **Metastore server**: `AggregateStatsCache`, `HiveMetaStore`, 
`CreateDatabaseHandler`, `LeaseLeaderElection`, `MetaStoreServerUtils`
   - **Security**: `DelegationTokenTool`, 
`TokenStoreDelegationTokenSecretManager`
   
   ## Change Pattern
   
   For catch blocks handling only `InterruptedException`:
   ```java
   } catch (InterruptedException e) {
   +   Thread.currentThread().interrupt();
       // existing handling (log, return, etc.)
   }
   ```
   
   For multi-catch blocks (e.g., `InterruptedException | ExecutionException`):
   ```java
   } catch (InterruptedException | ExecutionException e) {
   +   if (e instanceof InterruptedException) {
   +       Thread.currentThread().interrupt();
   +   }
       // existing handling
   }
   ```
   
   ## Test Plan
   
   - This is a mechanical, semantics-preserving fix. The added call simply 
restores a flag that the JVM cleared on entry to the catch block.
   - No behavioral change for non-interrupted execution paths.
   - Existing unit and integration tests continue to pass.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to