Opened 15 years ago

Closed 14 years ago

#988 closed Defect (fixed)

Core client can't terminate project applications (Windows only)

Reported by: Thyme Lawn Owned by: romw
Priority: Critical Milestone: 6.10
Component: Client - Daemon Version: 6.10.43
Keywords: Windows Cc: Richard, Haselgrove

Description

If a project application fails to respond to a <quit/> request the BOINC core client's attempt to kill the process always fails when running in Windows protected mode. I modified the core client to generate an error message when ACTIVE_TASK::kill_task() fails to kill the process. This generated the following:

23-Apr-2010 01:25:55 [---] [app_msg_send] sent <quit/> to famous_r3tj_599_200_000097119_0
23-Apr-2010 01:25:55 [---] [app_msg_send] sent <quit/> to v4_orca_janto_raha-tpssd-tzvpp_1171_0
23-Apr-2010 01:25:57 [CPDN Beta] [task_debug] task_state=EXITED for famous_r3tj_599_200_000097119_0 from has_task_exited
23-Apr-2010 01:26:00 [QMC@HOME] [error] Task v4_orca_janto_raha-tpssd-tzvpp_1171_0 TerminateProcessById(828) failed, GetLastError()=6 (The handle is invalid.
).
23-Apr-2010 01:26:00 [QMC@HOME] [task_debug] task_state=ABORTED for v4_orca_janto_raha-tpssd-tzvpp_1171_0 from kill_task

My additional error message indicates that the handle retrieved by OpenProcess?() can't be used by the core client.

All subsequent attempts to restart this task fail with a Can't acquire lockfile error until the task has been terminated. This can only be done by manually killing the task or by rebooting; stopping the BOINC service results in an orphaned task.

I repeated the test after using System Internals Process Explorer to grant the Terminate permission to the boinc_admins group for the QMC process. This time kill_task() successfully terminated the process:

23-Apr-2010 10:00:44 [---] [app_msg_send] sent <quit/> to famous_r3tj_599_200_000097119_0
23-Apr-2010 10:00:44 [---] [app_msg_send] sent <quit/> to v4_orca_janto_raha-tpssd-tzvpp_1171_0
23-Apr-2010 10:00:45 [CPDN Beta] [task_debug] task_state=EXITED for famous_r3tj_599_200_000097119_0 from has_task_exited
23-Apr-2010 10:00:49 [QMC@HOME] [task_debug] task_state=ABORTED for v4_orca_janto_raha-tpssd-tzvpp_1171_0 from kill_task

ACTIVE_TASK::start() needs to set up a security descriptor to assign the required privilege and pass it to CreateProcessAsUser?() (as the 4th parameter).

Change History (7)

comment:1 Changed 15 years ago by Richard Haselgrove

Cc: Richard Haselgrove added

comment:2 Changed 15 years ago by davea

Owner: changed from davea to romw

comment:3 Changed 15 years ago by romw

Status: newassigned

Thyme, when you say Windows protected mode, do you mean when UAC is turned on?

comment:4 Changed 15 years ago by romw

Milestone: Undetermined6.10

comment:5 Changed 15 years ago by Thyme Lawn

I mean a service installation Rom. The tests were run on an XP system.

comment:6 Changed 15 years ago by Thyme Lawn

Further information.

The QMC application used as an example was built using BOINC API version 6.3.0.

2 changes have been made to boinc_api.cpp since then which affect how Windows project applications respond to <quit/> requests.

[17640] modified boinc_exit() to follow up the call to TerminateProcess?() with calls to Sleep() and DebugBreak?() (first used in BOINC API version 6.7.5).

[20772] modified exit_from_timer_thread() to resume a task before calling boinc_exit(). That was checked in on 2nd March 2010 and the current trunk version number (6.11.1) was set on 23rd November 2009 (i.e. an <app_version> with <api_version>6.11.1</api_version> is not guaranteed to have that change).

For any application using the current trunk version of boinc_api.cpp I'd expect that a <quit/> request could only fail to be actioned if the application is in a critical section for longer than 5 seconds.

comment:7 Changed 14 years ago by Thyme Lawn

Resolution: fixed
Status: assignedclosed

[21295] resolves this problem.

Note: See TracTickets for help on using tickets.