<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    On 05/01/2025 10:20, Fabian Meumertzheim wrote:<br>
    <blockquote type="cite" cite="mid:CAHY-eHtU3332vZkNTqMGW=V3OY9xw=PSE4vqs2RNQ9vWjL9VEw@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">Hi,

I recently traced a race in an application
(<a class="moz-txt-link-freetext" href="https://github.com/bazelbuild/bazel/issues/21773">https://github.com/bazelbuild/bazel/issues/21773</a>) down to a
particular behavior of ExecutorService#close that, to me, doesn't seem
to be obvious from its documentation: If a task that has been
submitted to the executor is canceled while it is already executing,
ExecutorService#close will not wait for the associated Runnable to
return.
</pre>
    </blockquote>
    Thanks for bringing this up. TPTE interpreted "all tasks have
    completed execution" to mean all tasks done (Future::isDone) whereas
    it may have been better to have followed TPE and FJP and wait for
    all threads to have completed the tasks. So yes, some spec
    clarification may be needed here but it will need to take into
    account other ExecutorService implementation that may exist
    elsewhere. In addition, we need to think about changing TPTE to
    avoid the surprising behavior.<br>
    <br>
    -Alan<br>
  </body>
</html>