Merge lp:~xnox/upstart/dead-beef into lp:upstart/async

Proposed by Dimitri John Ledkov
Status: Rejected
Rejected by: Dimitri John Ledkov
Proposed branch: lp:~xnox/upstart/dead-beef
Merge into: lp:upstart/async
Diff against target: 219 lines (+5/-116)
1 file modified
init/job_process.c (+5/-116)
To merge this branch: bzr merge lp:~xnox/upstart/dead-beef
Reviewer Review Type Date Requested Status
James Hunt Disapprove
Review via email: mp+220334@code.launchpad.net
To post a comment you must log in.
Revision history for this message
James Hunt (jamesodhunt) wrote :

This branch causing panics for me resulting from 2 assertions firing:

job_process.c:3274: Assertion failed in job_process_close_handler: process == PROCESS_MAIN
log.c:815: Assertion failed in log_clear_unflushed: log->unflushed->len

review: Disapprove

Unmerged revisions

1650. By Dimitri John Ledkov

dead beef

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'init/job_process.c'
2--- init/job_process.c 2014-05-20 18:08:16 +0000
3+++ init/job_process.c 2014-05-20 22:11:39 +0000
4@@ -134,7 +134,7 @@
5 /* Prototypes for static functions */
6 static void job_process_kill_timer (Job *job, NihTimer *timer);
7 static void job_process_terminated (Job *job, ProcessType process,
8- int status, int state_only);
9+ int status);
10 static int job_process_catch_runaway (Job *job);
11 static void job_process_stopped (Job *job, ProcessType process);
12 static void job_process_trace_new (Job *job, ProcessType process);
13@@ -1118,10 +1118,7 @@
14 nih_free (err);
15 }
16
17-/* FIXME */
18-#if 0
19 nih_assert (job_process_fd != -1);
20-#endif
21
22 nih_info (_("%s %s process (%d)"),
23 job_name (job), process_name (process), job->pid[process]);
24@@ -2280,7 +2277,7 @@
25 job_name (job), process_name (process), pid);
26 }
27
28- job_process_terminated (job, process, status, FALSE);
29+ job_process_terminated (job, process, status);
30 break;
31 case NIH_CHILD_KILLED:
32 case NIH_CHILD_DUMPED:
33@@ -2301,7 +2298,7 @@
34 }
35
36 status <<= 8;
37- job_process_terminated (job, process, status, FALSE);
38+ job_process_terminated (job, process, status);
39 break;
40 case NIH_CHILD_STOPPED:
41 /* Child was stopped by a signal, make sure it was SIGSTOP
42@@ -2379,7 +2376,6 @@
43 * @job: job that changed,
44 * @process: specific process,
45 * @status: exit status or signal in higher byte,
46- * @state_only: if TRUE, only update the jobs state (not its goal).
47 *
48 * This function is called whenever a @process attached to @job terminates,
49 * @status should contain the exit status in the lower byte or signal in
50@@ -2391,8 +2387,7 @@
51 static void
52 job_process_terminated (Job *job,
53 ProcessType process,
54- int status,
55- int state_only)
56+ int status)
57 {
58 int failed = FALSE, stop = FALSE, state = TRUE;
59 struct utmpx *utmptr;
60@@ -2400,47 +2395,6 @@
61
62 nih_assert (job != NULL);
63
64- if (job->state == JOB_SECURITY_SPAWNING ||
65- job->state == JOB_PRE_STARTING ||
66- job->state == JOB_SPAWNING ||
67- job->state == JOB_POST_STARTING ||
68- job->state == JOB_PRE_STOPPING ||
69- job->state == JOB_POST_STOPPING) {
70- /* A child process has been spawned by
71- * job_process_spawn(), but we have not yet received
72- * confirmation of whether the child setup phase was
73- * successful or not.
74- *
75- * The fact that we are in this function means the child
76- * setup actually failed, however we handle that
77- * by waiting for the handlers registered by
78- * job_register_child_handler() to be called to deal
79- * with this error.
80- */
81- nih_assert (job->process_data);
82- nih_assert (job->process_data[process]);
83-
84- /* Add the child data for the *second* call to this
85- * function when the child pipe has been closed.
86- */
87- job->process_data[process]->status = status;
88-
89- job->state = job_next_state (job);
90-
91- return;
92- }
93-
94-#if 0
95- if (job->state == JOB_SECURITY ||
96- job->state == JOB_PRE_START ||
97- job->state == JOB_SPAWNED ||
98- job->state == JOB_POST_START ||
99- job->state == JOB_PRE_STOP ||
100- job->state == JOB_POST_STOP) {
101- nih_assert (job->process_data);
102- nih_assert (job->process_data->process == process);
103- }
104-#endif
105 switch (process) {
106 case PROCESS_MAIN:
107 nih_assert ((job->state == JOB_RUNNING)
108@@ -2611,7 +2565,7 @@
109 job->kill_process = PROCESS_INVALID;
110 }
111
112- if (job->class->console == CONSOLE_LOG && job->log[process] && ! state_only) {
113+ if (job->class->console == CONSOLE_LOG && job->log[process]) {
114 int ret;
115
116 /* It is imperative that we free the log at this stage to ensure
117@@ -2637,7 +2591,6 @@
118 job->log[process] = NULL;
119 }
120
121- if (! state_only) {
122 /* Find existing utmp entry for the process pid */
123 setutxent();
124 while ((utmptr = getutxent()) != NULL) {
125@@ -2666,20 +2619,11 @@
126
127 /* Clear the process pid field */
128 job->pid[process] = 0;
129- }
130
131 /* Mark the job as failed */
132 if (failed)
133 job_failed (job, process, status);
134
135- /* Cancel goal transition if the job state only should be
136- * changed.
137- */
138- if (state_only && stop) {
139- stop = 0;
140- nih_assert (! failed);
141- }
142-
143 /* Change the goal to stop; normally this doesn't have any
144 * side-effects, except when we're in the RUNNING state when it'll
145 * change the state as well. We obviously don't want to change the
146@@ -3301,7 +3245,6 @@
147 {
148 Job *job;
149 ProcessType process;
150- int status;
151
152 /* The job is in the process of being killed which must mean all
153 * the job pids are dead. Hence, there is no point in attempting
154@@ -3314,7 +3257,6 @@
155
156 job = process_data->job;
157 process = process_data->process;
158- status = process_data->status;
159
160 /* Ensure the job process error fd is closed before attempting
161 * to handle any scripts.
162@@ -3333,59 +3275,6 @@
163 job_change_state (job, job_next_state (job));
164 }
165 }
166-
167-#if 0
168- switch (job->state) {
169- case JOB_SPAWNING:
170- if (job->class->expect == EXPECT_NONE) {
171- nih_assert (process == PROCESS_MAIN);
172- job_change_state (job, job_next_state (job));
173- }
174- break;
175-
176- case JOB_SECURITY_SPAWNING:
177- case JOB_PRE_STARTING:
178- case JOB_POST_STARTING:
179- case JOB_PRE_STOPPING:
180- case JOB_POST_STOPPING:
181- job_change_state (job, job_next_state (job));
182- break;
183-
184- default:
185- /* NOP */
186- break;
187- }
188-#endif
189-
190-#if 0
191- else {
192- job_change_state (job, job_next_state (job));
193- }
194-#endif
195-
196- /* Don't change the jobs goal yet as the process may not have
197- * actually terminted (and hence will have
198- * job_process_terminated() called on it again later).
199- */
200- //job_process_terminated (job, process, status, TRUE);
201-
202- switch (job->state) {
203- /* FIXME: BUG: incomplete list of states!!!! */
204- case JOB_SECURITY_SPAWNING:
205- case JOB_PRE_STARTING:
206- case JOB_SPAWNING:
207- case JOB_POST_STARTING:
208- case JOB_PRE_STOPPING:
209- case JOB_POST_STOPPING:
210- job_process_terminated (job, process, status, TRUE);
211- break;
212-
213- default:
214- /* NOP */
215- break;
216- }
217-
218- //job_change_state (job, job_next_state (job));
219 }
220
221

Subscribers

People subscribed via source and target branches