EdColeman opened a new issue #1893:
URL: https://github.com/apache/accumulo/issues/1893
**Is your feature request related to a problem? Please describe.**
We are not consistent on handling interrupts.
**Describe the solution you'd like**
1) Code should not swallow interrupts without at least resetting the
interrupt flag - throwing an Exception if possible and appropriate.
2) If an exception cannot be thrown, the caller code should be checking
interrupt status and reacting if an interrupt occurs.
**Describe alternatives you've considered**
The situation described below is a concrete examples, but similar issues
occur in other places - these could be handled in bulk - or at least if the
code is modified for other reason, corrected at that time on a case by case
basis.
**Additional context**
When reviewing #1890 - the code in BulkImportCacheCleaner caught the
interrupt exception like this:
```
} catch (KeeperException | InterruptedException e) {
// we'll just clean it up again later
log.debug("Error reading bulk import live transactions {}", e);
}
```
The code was modified to reassert the interrupt with:
https://github.com/apache/accumulo/blob/307bef2fe6a8b2b7152eabaf9b16950cff72729a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/BulkImportCacheCleaner.java#L57-L64
The caller code - in TabletServer schedules this task with the following:
https://github.com/apache/accumulo/blob/6af856b38bb57f49418547a8b9c262c66a1fe31e/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java#L778-L780
The call to `scheduleWithFixedDelay` returns a `ScheduledFuture.` that
future could be used to attempt to cancel running tasks - or at least prevent
new tasks from being scheduled if the interrupt status was checked. The goal
would be to provide a more graceful approach to termination when possible (like
closing file descriptors) - or at least improve termination responsiveness,
The running tasks would probably need to properly handle `mayInterruptIfRunning
`
Other considerations:
Some of the exception handling may have improved with the standardization of
thread pools in #1808 - and maybe that code could also check for interrupts as
an alternate approach.
This task may overlap with #946
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]