First push with null patch, to get current gitlab runner result in [pipeline #42287](https://gitlab.winehq.org/bernhardu/wine/-/pipelines/42287). Unfortunately, did not fail this time.
Older examples are: - [job #157583](https://gitlab.winehq.org/wine/wine/-/jobs/157583#L2282) - [job #157314](https://gitlab.winehq.org/wine/wine/-/jobs/157314#L1957) - [job #157131](https://gitlab.winehq.org/wine/wine/-/jobs/157131#L2052) - [job #157068](https://gitlab.winehq.org/wine/wine/-/jobs/157068#L1955) - [job #157032](https://gitlab.winehq.org/wine/wine/-/jobs/157032#L2150) - [job #156785](https://gitlab.winehq.org/wine/wine/-/jobs/156785#L2112) - [job #156713](https://gitlab.winehq.org/wine/wine/-/jobs/156713#L2048) - [job 156677#](https://gitlab.winehq.org/wine/wine/-/jobs/156677#L2030)
So happens just a few times per day.
The value -1073741510 in `timeout.exe:timeout:06b4 done (-1073741510) in 5s 177B` equals to 0xC000013A, STATUS_CONTROL_C_EXIT. Therefore the assumption the ctrl-c from the test reaches sometimes the parent process.
With the patch activated, this [pipeline #42291](https://gitlab.winehq.org/bernhardu/wine/-/pipelines/42291).
-- v5: timeout/tests: Move the ctrl-c tests below an intermediate process.
From: Bernhard Übelacker bernhardu@mailbox.org
This is an attempt to avoid some flaky test failures where the parent test process returns a STATUS_CONTROL_C_EXIT exit code. --- programs/timeout/tests/timeout.c | 41 ++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-)
diff --git a/programs/timeout/tests/timeout.c b/programs/timeout/tests/timeout.c index bd99eb9e5e1..bb65620f442 100644 --- a/programs/timeout/tests/timeout.c +++ b/programs/timeout/tests/timeout.c @@ -130,15 +130,47 @@ static void _run_timeout_ctrlc(const char *file, int line, const char *option, D exitcode_expected, exitcode); }
-static void test_ctrlc(void) +static void test_ctrlc(int argc, char** argv) { - run_timeout_ctrlc("", STATUS_CONTROL_C_EXIT); - run_timeout_ctrlc("/nobreak", 1); + if (!strcmp(argv[3], "normal")) + run_timeout_ctrlc("", STATUS_CONTROL_C_EXIT); + else if (!strcmp(argv[3], "nobreak")) + run_timeout_ctrlc("/nobreak", 1); + else + ok(0, "Unknown test %s.\n", argv[3]); +} + +static void test_ctrlc_intermediate(int argc, char** argv, const char* name) +{ + char path_name[MAX_PATH]; + STARTUPINFOA startup; + PROCESS_INFORMATION info; + + memset(&startup, 0, sizeof(startup)); + startup.cb = sizeof(startup); + sprintf(path_name, "%s %s %s %s", argv[0], argv[1], "ctrlc_intermediate", name); + ok(CreateProcessA(NULL, path_name, NULL, NULL, FALSE, + CREATE_NEW_PROCESS_GROUP | CREATE_NEW_CONSOLE, + NULL, NULL, &startup, &info), + "CreateProcess failed.\n"); + wait_child_process(info.hProcess); + CloseHandle(info.hProcess); + CloseHandle(info.hThread); }
START_TEST(timeout) { + int argc; + char** argv; BOOL ret; + + argc = winetest_get_mainargs(&argv); + if(argc == 4 && !strcmp(argv[2], "ctrlc_intermediate")) + { + test_ctrlc(argc, argv); + return; + } + /* always run on a separate console, so that: * - we're sure to have a valid console input handle (no Wine unix console...) * - we can send ctrl-c events without interfering with parent (winetest...) @@ -158,5 +190,6 @@ START_TEST(timeout) }
test_basic(); - test_ctrlc(); + test_ctrlc_intermediate(argc, argv, "normal"); + test_ctrlc_intermediate(argc, argv, "nobreak"); }
On Thu May 15 15:18:59 2025 +0000, eric pouech wrote:
didn't try it (and my first post wasn't 100% clear, sorry about that), but I think we need an intermediate process for each one of the two tests... basically we don't control when the ctrl-c event is dispatched, so as soon as GenerateConsoleCtrlEvent is called, re-enabling ctrl-c opens a window of risk if the event isn't dispatched soon enough in the error you see, did you discriminate which process is 0x61c?
Thanks for your patience, I rearranged the test to put the intermediate between both ctrl-c tests. Unfortunately I can't now tell which process 0x61c was.
Trying to continue to test.
On Thu May 15 16:00:35 2025 +0000, Bernhard Übelacker wrote:
Thanks for your patience, I rearranged the test to put the intermediate between both ctrl-c tests. Unfortunately I can't now tell which process 0x61c was. Trying to continue to test.
I did some more tests and found without current git without this patch I can quite reliable reproduce the issue, this are some points which I think are important: - happens with both, old- and new-wow64 - load some stress on the cpu: `stress --cpu 16` - `WINEDLLOVERRIDES=winemenubuilder.exe=n WINEDEBUG=+pid WINETEST_DEBUG=10 wine programs/winetest/i386-windows/winetest.exe -o - -J - timeout.exe`
Following example may be interesting, because the last timeout.exe execution start is logged while timeout.exe_test.exe seems already finished: ``` Test output: timeout.exe:timeout start programs/timeout/tests/timeout.c 0134:0138:err:environ:init_peb starting L"C:\users\bernhard\AppData\Local\Temp\wct2b8a.tmp\timeout.exe_test.exe" in experimental wow64 mode 0144:0148:err:environ:init_peb starting L"C:\windows\syswow64\timeout.exe" in experimental wow64 mode 014c:0150:err:environ:init_peb starting L"C:\windows\syswow64\timeout.exe" in experimental wow64 mode 0154:0158:err:environ:init_peb starting L"C:\windows\syswow64\timeout.exe" in experimental wow64 mode 015c:0160:err:environ:init_peb starting L"C:\windows\syswow64\timeout.exe" in experimental wow64 mode 0164:0168:err:environ:init_peb starting L"C:\windows\syswow64\timeout.exe" in experimental wow64 mode 016c:0170:err:environ:init_peb starting L"C:\windows\syswow64\timeout.exe" in experimental wow64 mode 0174:0178:err:environ:init_peb starting L"C:\windows\syswow64\timeout.exe" in experimental wow64 mode 017c:0180:err:environ:init_peb starting L"C:\windows\syswow64\timeout.exe" in experimental wow64 mode 0184:0188:err:environ:init_peb starting L"C:\windows\syswow64\timeout.exe" in experimental wow64 mode 018c:0190:err:environ:init_peb starting L"C:\windows\syswow64\timeout.exe" in experimental wow64 mode 018c:0194:fixme:console:default_ctrl_handler Terminating process 18c on event 0 0134:0198:fixme:console:default_ctrl_handler Terminating process 134 on event 0 timeout.c:61:2.141 Test succeeded timeout.c:65:3.482 Test succeeded timeout.c:69:4.699 Test succeeded timeout.c:135:7.510 Test succeeded timeout.exe:timeout:0134 done (-1073741510) in 7s 141B 019c:01a0:err:environ:init_peb starting L"C:\windows\syswow64\timeout.exe" in experimental wow64 mode ```
Without this MR's patch and the stressed cpu the issue shows up in around 5 of 10 attempts.
With this MR's patch in the same environment 10 of 10 runs did succeed.
LGTM
I would favor also removing the flaky_wine_if line.