title: Thread pool starvation in docker container
body: <p>I'm experiencing this kind of problem for the first time. I'm running an application in a container with some hosted services (AspNet, Core C# 8.0, Docker container Linux). The first service do a big data ingestion in my database. 
  I will explain the service: it just start, download from the web and download a 2gb file with a lot of JSON inside. Then it add one by one every JSON file deserialized in my database.
  It starts pretty well, but after 500.000 records starting to slow up and does not end the data ingestion. If I run</p>
  
  <pre><code>docker logs -f &lt;container&gt;
  </code></pre>
  
  <p>I get this message:</p>
  
  <p><a href="https://i.stack.imgur.com/fdni4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fdni4.png" alt="enter image description here"></a></p>
  
  <p>With docker stats, I see my container using all the resource possible.
  Thanks a lot for any assistance!</p>
  
  <p>This is the HS:</p>
  
  <pre><code>    private void DoWork(object state)
              {
                  using (IServiceScope scope = _services.CreateScope())
                  {
                      executionCount++;
                      IVUManager _vuManager = scope.ServiceProvider.GetRequiredService&lt;IVUManager&gt;();
                      _vuManager.BulkLoaderVuMassive();
                  }
            }
  </code></pre>
  
  <p>This is the code part managing the JSON file:</p>
  
  <pre><code>           foreach (string filename in filesnumber)
              {
                  using (StreamReader r = new StreamReader(filename))
                  {
                      //Parsin JSON
                      aInt++;
                      string jsonFull = r.ReadToEnd();
                      JsonDocument jsonDoc = JsonDocument.Parse(jsonFull);
                      JsonElement jsonParsed = jsonDoc.RootElement;
                      ASoVu newVU = new ASoVu();
  
                      newVU = _importStrategy.VU();
  
                      _repository.MassiveImportNVD(_context, newVUL)
  
                      if (aInt == 9999)
                      {
                          _repository.Save(_context);
                      }
  
                  }
              }
  </code></pre>
  
  <p>This is the code part that make the insert inside the database:</p>
  
  <p>public class VURepository : IVURepository
  {
      private readonly ILogger _logger;</p>
  
  <pre><code>public VURepository(ILogger&lt;VURepository&gt; logger)
  {
      _logger = logger;
  }
  
  public void MassiveImport(VMContext _context, ASoVu newVU)
  {
      _context.Vu.Add(newVU);
  }
  </code></pre>