[PATCH v2 0/1] MR3648: server: Set the default thread exit code to 1.
The default exit code is only used when a process is killed by the system or through a signal. These are exceptional cases where exit code 1 (killed by Task Manager) is more appropriate than the normal termination code of 0. Chromium does not restart helper processes that exit with code 0 (see [kill.h](https://source.chromium.org/chromium/chromium/src/+/main:base/process/kill.h...)), with this fix they are restarted when killed by the system or by a signal. -- v2: server: Set the default thread exit code to 1. https://gitlab.winehq.org/wine/wine/-/merge_requests/3648
From: Brendan Shanks <bshanks(a)codeweavers.com> The default exit code is only used when a process is killed by the system or through a signal. These are exceptional cases where exit code 1 (killed by Task Manager) is more appropriate than the normal termination code of 0. --- server/process.c | 2 +- server/thread.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/process.c b/server/process.c index a0d5ea64d97..1971a2751f0 100644 --- a/server/process.c +++ b/server/process.c @@ -919,7 +919,7 @@ static void terminate_process( struct process *process, struct thread *skip, int restart: LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry ) { - if (exit_code) thread->exit_code = exit_code; + thread->exit_code = exit_code; if (thread == skip) continue; if (thread->state == TERMINATED) continue; kill_thread( thread, 1 ); diff --git a/server/thread.c b/server/thread.c index 3e35b27f694..2621d5af070 100644 --- a/server/thread.c +++ b/server/thread.c @@ -239,7 +239,7 @@ static inline void init_thread_structure( struct thread *thread ) thread->reply_fd = NULL; thread->wait_fd = NULL; thread->state = RUNNING; - thread->exit_code = 0; + thread->exit_code = 1; /* default to "killed by Task Manager" unless set otherwise */ thread->priority = 0; thread->suspend = 0; thread->dbg_hidden = 0; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3648
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details: The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=136718 Your paranoid android. === debian11b (64 bit WoW report) === Report validation errors: ntdll:exception is missing some failure messages
Alexandre Julliard (@julliard) commented about server/process.c:
restart: LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry ) { - if (exit_code) thread->exit_code = exit_code; + thread->exit_code = exit_code; This would cause the exit code to be reset if a thread had a failure during process exit for instance.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3648#note_43492
On Sat Aug 26 10:18:29 2023 +0000, Alexandre Julliard wrote:
This would cause the exit code to be reset if a thread had a failure during process exit for instance. Hmm, I'm having trouble following this. Is the intent here that if a thread's `exit_code` has already been set, it will only be overwritten in `terminate_process()` by a non-zero process exit code?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3648#note_43646
Hmm, I'm having trouble following this. Is the intent here that if a thread's `exit_code` has already been set, it will only be overwritten in `terminate_process()` by a non-zero process exit code?
Yes, there are various race conditions when multiple threads terminate at the same time, and we want to make sure that failures are reported. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3648#note_43668
participants (4)
-
Alexandre Julliard (@julliard) -
Brendan Shanks -
Brendan Shanks (@bshanks) -
Marvin