title: "ls" in a container within a volume shared with Windows host gets stuck when there are many files in a directory
body: <h1>Background</h1>
  
  <p>I am running a Spring Boot application in a docker container (Ubuntu image).
  The code is written in Kotlin and it walks through a directory on disk that contains 300,000 files.<br>
  I run the following code:  </p>
  
  <pre><code>  File(dir)
      .walk()
      .forEach{logger.info("{}", it.name)}
  </code></pre>
  
  <p>and this code blocks for at least 10 minutes.  </p>
  
  <p>I would expect that lines should start being printed very shortly after invoking walk.<br>
  Indeed the code works as expected when running it from Intellij - that is, not in a container.</p>
  
  <h1>Question:</h1>
  
  <p>Why is this happening and how can I fix it?</p>
  
  <hr>
  
  <h2>What I Have Tried</h2>
  
  <h2>First Trial</h2>
  
  <p>I have tried just calling File.listfiles and logging the number of files like so:  </p>
  
  <pre><code>   val count = File(dir).listFiles().size
     logger.info("{}", count)
  </code></pre>
  
  <p>This also blocked for a very long time and eventually logged the value 0.</p>
  
  <h2>Second Trial</h2>
  
  <p>I changed the settings for Docker Desktop.
  I increased the RAM to 20 GB and the swap file to to 1 GB<br>
  This had no effect on the result.</p>