kill: Support killing any queued task by interrupting it

We probably don't have enough cancellation points in our code to
really kill most tasks before they fully complete.  For example,
most of the JGit upload-pack and receive-pack code path uses
NullProgressMonitor, which unfortunately does not check if the
calling thread has been interrupted.

Change-Id: I57379ba77d7aefc720421d74771fb65ab6be61fa
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-11-20 20:15:41 -08:00
parent 0f28761ff1
commit 3f1a13afb3
15 changed files with 457 additions and 139 deletions

View File

@@ -8,14 +8,15 @@ gerrit show-queue - Display the background work queues, including replication
SYNOPSIS
--------
[verse]
'ssh' -p <port> <host> 'ps'
'ssh' -p <port> <host> 'gerrit show-queue'
DESCRIPTION
-----------
Presents a table of the pending background activity the Gerrit
daemon will perform in the near future. Gerrit contains an internal
scheduler, similar to cron, that it uses to queue and dispatch both
short and long term background activity.
Presents a table of the pending activity the Gerrit daemon
is currently performing, or will perform in the near future.
Gerrit contains an internal scheduler, similar to cron, that it
uses to queue and dispatch both short and long term activity.
Tasks that are completed or cancelled exit the queue very quickly
once they enter this state, but it can be possible to observe tasks
@@ -32,22 +33,26 @@ Intended for interactive use only.
DISPLAY
-------
S::
Current state of the task. States are:
+
* `D`: task is complete, but hasn't released its worker yet.
* `C`: task has been cancelled, but hasn't left the queue yet.
* `R`: task is actively running on a worker thread.
* `W`: task is ready to run, waiting for a worker thread.
* `S`: task is sleeping until its Start time.
Start::
Time (local to the server) that this task will begin
execution. Blank if the task is completed, running, or
ready to run but is waiting for a worker thread to become
available.
Task::
Unique task identifier on this server. May be passed into
link:cmd-kill.html[kill] to cancel or terminate the task.
Task identifiers have a period of 2\^32-1, and start from
a random value.
State::
If running, blank.
+
If the task has completed, but has not yet been reaped, 'done'.
If the task has been killed, but has not yet halted or been removed
from the queue, 'killed'.
+
If the task is ready to execute but is waiting for an idle thread
in its associated thread pool, 'waiting'.
+
Otherwise the time (local to the server) that this task will begin
execution.
Command::
Short text description of the task that will be performed
at the given time.
@@ -60,20 +65,14 @@ and `dst2`:
====
$ ssh -p 29418 review.example.com gerrit show-queue
S Start Task
--------------------------------------------------------------
S 14:31:15.435 mirror dst1:/home/git/tools/gerrit.git
S 14:31:25.434 mirror dst2:/var/cache/tools/gerrit.git
--------------------------------------------------------------
Task State Command
------------------------------------------------------------------------------
7aae09b2 14:31:15.435 mirror dst1:/home/git/tools/gerrit.git
9ad09d27 14:31:25.434 mirror dst2:/var/cache/tools/gerrit.git
------------------------------------------------------------------------------
2 tasks
====
DEFECTS
-------
There is a small race condition where tasks may disappear from the
output of this command while they transition from the ready/waiting
(`W`) or sleeping (`S`) state to the running (`R`) state.
GERRIT
------
Part of link:index.html[Gerrit Code Review]