Commit 4f084921 authored by David Anderson's avatar David Anderson
Browse files

client: increase app-exit timeout from 15 to 60

This is the interval between when the client sends a "quit" message
to when it kills the app via TerminateProcess or SIGKILL.

Apparently VM apps that do their own state-saving
(i.e. that don't use snapshot-based checkpointing)
can take more than 15 seconds to do so.
Hopefully 60 is enough.

Rom suggested making this interval shorter in the case where
the OS is shutting down.
I don't think this is necessary since the OS kill everything anyway
after some period (5 sec in the case of Win 10).
parent 5f075e9a
......@@ -1052,19 +1052,24 @@ void ACTIVE_TASK_SET::request_reread_app_info() {
// send quit message to all tasks in the project
// (or all tasks, if proj==0).
// If they don't exit in 5 seconds,
// (or all tasks, if proj is NULL).
// If they don't exit in MAX_EXIT_TIME seconds,
// send them a kill signal and wait up to 5 more seconds to exit.
// This is called when the client exits,
// or when a project is detached or reset
//
// MAX_EXIT_TIME should be large enough that apps
// can finalize (e.g. write checkpoint file) in that time.
// In Nov 2015 we increased it from 15 to 60
// because CERN's VBox apps take a long time to save state.
//
int ACTIVE_TASK_SET::exit_tasks(PROJECT* proj) {
if (log_flags.task_debug) {
msg_printf(NULL, MSG_INFO, "[task_debug] requesting tasks to exit");
}
request_tasks_exit(proj);
// Wait 15 seconds for them to exit normally; if they don't then kill them
// Wait for tasks to exit normally; if they don't then kill them
//
if (wait_for_exit(MAX_EXIT_TIME, proj)) {
if (log_flags.task_debug) {
......
......@@ -2148,16 +2148,23 @@ int CLIENT_STATE::quit_activities() {
//
adjust_rec();
daily_xfer_history.write_file();
write_state_file();
gui_rpcs.close();
abort_cpu_benchmarks();
time_stats.quit();
// stop jobs.
// Do this last because it could take a long time,
// and the OS might kill us in the middle
//
int retval = active_tasks.exit_tasks();
if (retval) {
msg_printf(NULL, MSG_INTERNAL_ERROR,
"Couldn't exit tasks: %s", boincerror(retval)
);
}
write_state_file();
gui_rpcs.close();
abort_cpu_benchmarks();
time_stats.quit();
return 0;
}
......
......@@ -596,7 +596,7 @@ extern THREAD throttle_thread;
#define DEADLINE_CUSHION 0
// try to finish jobs this much in advance of their deadline
#define MAX_EXIT_TIME 15
#define MAX_EXIT_TIME 60
// if an app takes this long to exit, kill it
#define MAX_STARTUP_TIME 10
......
......@@ -322,7 +322,6 @@ static int finalize() {
if (finalized) return 0;
finalized = true;
gstate.quit_activities();
daily_xfer_history.write_file();
#ifdef _WIN32
shutdown_idle_monitor();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment