[webkit-changes] [WebKit/WebKit] c4ef86: [webkitcorepy] Prevent `TaskPool` from blocking af...

Vitaly Dyachkov noreply at github.com
Thu Jan 19 16:39:38 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c4ef868fe788c1cf78a68a08bc18887159c88aae
      https://github.com/WebKit/WebKit/commit/c4ef868fe788c1cf78a68a08bc18887159c88aae
  Author: Vitaly Dyachkov <vitaly at igalia.com>
  Date:   2023-01-19 (Thu, 19 Jan 2023)

  Changed paths:
    M Tools/Scripts/libraries/webkitcorepy/webkitcorepy/task_pool.py

  Log Message:
  -----------
  [webkitcorepy] Prevent `TaskPool` from blocking after exceeding failure threshold
https://bugs.webkit.org/show_bug.cgi?id=24784

Reviewed by Jonathan Bedard.

`TaskPool` uses `_BiDirectionalQueue` to communicate with its worker
`_Process`es. `TaskPool` sends `Task`s to the queue and receives
`_Result` back. `_BiDirectionalQueue` is implemented as two
`multiprocessing.Queue`.

When `TaskPool` puts some tasks on the `outgoing` queue it will
by default not terminate until all of them have been flushed to the
underlying pipe. If we terminate all the workers because of an exception
the pipe might stay full with no one reading from it. It is a deadlock.

We now call `cancel_join_thread()` before terminating the workers and
closing the queue to make `join_thread()` do nothing.

* Tools/Scripts/libraries/webkitcorepy/webkitcorepy/task_pool.py:
(_BiDirectionalQueue.__init__):
(_BiDirectionalQueue.close):

Canonical link: https://commits.webkit.org/259119@main




More information about the webkit-changes mailing list