James Hunt has proposed merging lp:~jamesodhunt/upstart/bug-1338968 into lp:upstart.
Requested reviews: Upstart Reviewers (upstart-reviewers) Related bugs: Bug #1338968 in upstart : "async upstart crashes after many re-execs" https://bugs.launchpad.net/upstart/+bug/1338968 For more details, see: https://code.launchpad.net/~jamesodhunt/upstart/bug-1338968/+merge/225981 -- https://code.launchpad.net/~jamesodhunt/upstart/bug-1338968/+merge/225981 Your team Upstart Reviewers is requested to review the proposed merge of lp:~jamesodhunt/upstart/bug-1338968 into lp:upstart.
=== modified file 'ChangeLog' --- ChangeLog 2014-07-08 10:02:43 +0000 +++ ChangeLog 2014-07-08 14:12:55 +0000 @@ -3,6 +3,13 @@ * init/main.c: main(): - Only create inotify watches if not restarting or if performing a stateless re-exec (LP: #1338637). + * init/job_process.c: + - job_process_data_serialise(): + - Unconditionally toggle CLOEXEC for job_process_fd (LP: #1338968). + - Disregard valid flag when toggling CLOEXEC for script_fd since if + the JobProcessData still exists, we need the fd to persist across + the re-exec. + - job_process_data_deserialise(): As above. 2014-07-07 James Hunt <[email protected]> === modified file 'init/job_process.c' --- init/job_process.c 2014-07-03 08:59:30 +0000 +++ init/job_process.c 2014-07-08 14:12:55 +0000 @@ -2707,6 +2707,8 @@ if (! process_data) return json; + nih_assert (process_data->job_process_fd != -1); + /* XXX: Note that Job is not serialised; it's not necessary * since the JobProcessData itself is serialised within its Job * and the job pointer can be reinstated on deserialisation. @@ -2720,18 +2722,17 @@ if (! state_set_json_string_var_from_obj (json, process_data, script)) goto error; - if (process_data->shell_fd != -1 && process_data->valid) { - - /* Clear the cloexec flag to ensure the descriptors - * remains open across the re-exec. - */ + /* Clear the cloexec flag to ensure the descriptors + * remains open across the re-exec. + */ + if (process_data->shell_fd != -1) { if (state_modify_cloexec (process_data->shell_fd, FALSE) < 0) goto error; - - if (state_modify_cloexec (process_data->job_process_fd, FALSE) < 0) - goto error; } + if (state_modify_cloexec (process_data->job_process_fd, FALSE) < 0) + goto error; + if (! state_set_json_int_var_from_obj (json, process_data, shell_fd)) goto error; @@ -2797,17 +2798,17 @@ if (! state_get_json_int_var_to_obj (json, process_data, valid)) goto error; - if (process_data->shell_fd != -1 && process_data->valid) { - /* Reset the cloexec flag to ensure the descriptors - * are not leaked to any child processes. - */ + /* Reset the cloexec flag to ensure the descriptors + * are not leaked to any child processes. + */ + if (process_data->shell_fd != -1) { if (state_modify_cloexec (process_data->shell_fd, TRUE) < 0) goto error; - - if (state_modify_cloexec (process_data->job_process_fd, TRUE) < 0) - goto error; } + if (state_modify_cloexec (process_data->job_process_fd, TRUE) < 0) + goto error; + return process_data; error:
-- upstart-devel mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel
