elastic/elasticsearch · warning · IOException
Interrupted while deleting.
Error message
Interrupted while deleting.
What it means
Thrown by deleteWithRetry(Path) when its inner deleteWithRetry0 is interrupted (InterruptedException caught). It is the checked variant — the method declares throws IOException. The thread's interrupt status is NOT re-set here (note: only the wrapper at line 1247 restores it via the caller pattern in some paths). Retries are Windows-only (MAX_RETRY_DELETE_TIMES=15, RETRY_DELETE_MILLIS=500ms).
Source
Thrown at build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java:1236
LOGGER.info("[{}] Timed out waiting for process to exit", name, e);
}
}
private static final int RETRY_DELETE_MILLIS = OS.current() == OS.WINDOWS ? 500 : 0;
private static final int MAX_RETRY_DELETE_TIMES = OS.current() == OS.WINDOWS ? 15 : 0;
/**
* Deletes a path, retrying if necessary.
*
* @param path the path to delete
* @throws IOException
* if an I/O error occurs
*/
void deleteWithRetry(Path path) throws IOException {
try {
deleteWithRetry0(path);
} catch (InterruptedException x) {
throw new IOException("Interrupted while deleting.", x);
}
}
/** Unchecked variant of deleteWithRetry. */
void uncheckedDeleteWithRetry(Path path) {
try {
deleteWithRetry0(path);
} catch (IOException e) {
throw new UncheckedIOException(e);
} catch (InterruptedException x) {
throw new UncheckedIOException("Interrupted while deleting.", new IOException());
}
}
// The exception handling here is loathsome, but necessary!
private void deleteWithRetry0(Path path) throws IOException, InterruptedException {
int times = 0;
IOException ioe = null;View on GitHub (pinned to db6a809a66)
Solutions
- If this was a user-initiated cancellation, ignore it — the interrupt is expected.
- If unexpected, check the gradle daemon logs for why the thread was interrupted (daemon memory pressure, timeout).
- On Windows, ensure no other process (antivirus, file explorer) holds the file so the delete succeeds on the first attempt without entering the retry/sleep loop.
Defensive patterns
Strategy: try-catch
Try / catch
try {
deleteWithRetry0(path);
} catch (InterruptedException x) {
throw new IOException("Interrupted while deleting.", x);
} Prevention
- On Windows, close all handles on the path before teardown to avoid the retry/sleep loop.
- Avoid cancelling the build during cluster teardown.
When it happens
Trigger: A gradle task or test framework interrupts the thread while deleteWithRetry0 is in Thread.sleep(RETRY_DELETE_MILLIS) between delete attempts. The sleep is only entered on Windows when Files.notExists(path) is still false after a delete.
Common situations: Gradle cancels the build (Ctrl-C, task timeout, daemon eviction) during cluster teardown on Windows; a watchdog interrupts the cleanup thread.
Related errors
- File still exists after {} waits.
- Interrupted while waiting for {}
- Failed to tail log {}
- Interrupted while waiting for ports files
- Number of nodes should be >= 1 but was {} for {}
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/557498c7215c2671.
Report an issue: GitHub.