[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #51237] Deadlock in Ctrl-C handler on Windows
From: |
Michael Builov |
Subject: |
[bug #51237] Deadlock in Ctrl-C handler on Windows |
Date: |
Thu, 15 Jun 2017 10:34:01 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0 |
Follow-up Comment #3, bug #51237 (project make):
I have created test application, which detaches console and sleeps for 1000
seconds:
#include <windows.h>
int main(int argc, char *argv[]) {
FreeConsole();
Sleep(1000000);
return 0;
}
And tested it with this makefile:
# run make -j -O, then press Ctrl+C
all: a b c d
CMD := C:\test.exe
a:;$(CMD)
b:;$(CMD)
c:;$(CMD)
d:;$(CMD)
.PHONY: all a b c d
I see next behaviors of original/pached make on Ctrl+C.
1) Original make-4.2.1.
- Main thread is suspended in WaitForMultipleObjects.
- Ctrl+C handler thread waits for one of 4 sub-processes in
WaitForMultipleObjects.
2) Patched make-4.2.1.
- Main thread waits for one of 4 sub-processes in WaitForMultipleObjects.
- Ctrl+C handler thread waits for Main thread in WaitForSingleObject.
Both makes hang for 1000 seconds.
...
For this test, it is possible to fix Ctrl+C handler in original make, so it
will kill sub-processes.
(replace SIGTERM with SIGINT in fatal_error_signal, because "The SIGILL and
SIGTERM signals are not generated under Windows. They are included for ANSI
compatibility").
And this is works, but only top child processes get killed:
If I use
CMD := cmd.exe /c "C:\test.exe"
Then by Ctrl+C, make kills only cmd.exe, and C:\test.exe continues to live.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51237>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/