# Massive queue in "refresh" thread pool on a single node, causing timeouts

**URL:** https://discuss.elastic.co/t/massive-queue-in-refresh-thread-pool-on-a-single-node-causing-timeouts/280732
**Category:** Elasticsearch
**Created:** [August 8, 2021, 1:54pm UTC](https://discuss.elastic.co/t/massive-queue-in-refresh-thread-pool-on-a-single-node-causing-timeouts/280732 "2021-08-08T13:54:57Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [August 11, 2021, 6:53pm UTC](https://discuss.elastic.co/t/massive-queue-in-refresh-thread-pool-on-a-single-node-causing-timeouts/280732/7 "2021-08-11T18:53:05Z")

</div>

Not to say that there's no locking going on, but we definitely see that the thread is not waiting for a monitor or anything, it's stuck deleting a file for far too long:

> [@Rayzbam](#):
>
> ```auto
> 0.0% (0s out of 500ms) cpu usage by thread 'elasticsearch[PRODUCTION_CRITQUE_2][refresh][T#2]'
> 10/10 snapshots sharing following 39 elements
> sun.nio.fs.WindowsNativeDispatcher.DeleteFile0(Native Method)
> sun.nio.fs.WindowsNativeDispatcher.DeleteFile(WindowsNativeDispatcher.java:114)
> sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:249)
> sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
> java.nio.file.Files.delete(Files.java:1126)
> 
> ```

`sun.nio.fs.WindowsNativeDispatcher.DeleteFile0` is a native method whose implementation in the JDK is this:

> <https://github.com/openjdk/jdk/blob/jdk-16%2B36/src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c#L261-L268>

Pretty much the only thing it could be doing is waiting for [`DeleteFileW`](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilew) to return.

I don't know a huge amount about debugging this kind of thing in Windows (vs say Linux) but I believe that [Process Monitor](https://docs.microsoft.com/en-us/sysinternals/downloads/procmon) should show these delete calls taking a long time too.

---

_[View the full topic](https://discuss.elastic.co/t/massive-queue-in-refresh-thread-pool-on-a-single-node-causing-timeouts/280732)._
