What's the correct way to cancel a ninja build in progress?

680 views
Skip to first unread message

Stephen Cheng

unread,
Sep 27, 2013, 6:26:15 PM9/27/13
to chromi...@chromium.org
Every time I try to cancel to a ninja build in progress by ctrl+c, I might get a perl.exe crash and there are many instance of cl.exe left behind. I would have to kill all those processes manually. Is there a better way to stop the build more nicely?

Zachary Turner

unread,
Sep 27, 2013, 7:33:32 PM9/27/13
to Shanfeng Cheng, Chromium-dev
For some reason I've never had this problem so I can't say specifically why it's happening, but since ninja.exe is the parent of all spawned processes, why not find ninja.exe in Task Manager and right click it and choose End Process Tree?  (Note that there will be many instances of ninja.exe, but only a single instance with the command line that you originally launched it with.

You could script this into a batch file or powershell file I suppose, so that you could just type kill_ninja_build.bat from a command prompt.  

If you're feeling adventurous, you could try to investigate why it's happening.  I kill ninja builds in progress all the time, and have never seen this.


On Fri, Sep 27, 2013 at 3:26 PM, Stephen Cheng <sfc...@gmail.com> wrote:
Every time I try to cancel to a ninja build in progress by ctrl+c, I might get a perl.exe crash and there are many instance of cl.exe left behind. I would have to kill all those processes manually. Is there a better way to stop the build more nicely?

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Scott Graham

unread,
Sep 27, 2013, 7:51:41 PM9/27/13
to Zachary Turner, Shanfeng Cheng, Chromium-dev
Perl crashes because Perl crashes. Hopefully there won't be any perl soon. Perl launches cl.exes to do preprocessing, and if it's launched via cygwin, which it is for some rules in Blink, they won't be in same process tree because cygwin is dumb. In that case, if perl crashes, they won't die because they're completely disassociated from ninja.

In regular compilation, ninja waits for all subprocesses to terminate on Ctrl-C after sending them a Ctrl-C. If you hammer on Ctrl-C while it's waiting for shutdown though, it aborts the abort, and exits without waiting for the cl.exes to terminate. You should not see any leaked compiler processes from standard compilation if you just press Ctrl-C once.

(It's possible we should change ninja to never exit until the subprocesses are reaped or you Ctrl-Break.)

Paweł Hajdan, Jr.

unread,
Sep 27, 2013, 8:38:18 PM9/27/13
to Scott Graham, Zachary Turner, Shanfeng Cheng, Chromium-dev
How about using job objects and JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE?

Paweł
Reply all
Reply to author
Forward
0 new messages