James Hunt has proposed merging lp:~jamesodhunt/upstart/bug-1096531 into 
lp:upstart.

Requested reviews:
  Upstart Reviewers (upstart-reviewers)

For more details, see:
https://code.launchpad.net/~jamesodhunt/upstart/bug-1096531/+merge/143314

* init/log.c:
  - log_clear_unflushed(): Correct remote_closed assertion to handle
    early-job-logging scenario where a job satisfies both of the
    following conditions:
    - ends before the log directory becomes writeable.
    - has spawned one or more processes that continue to run after the
      job itself has exited and which produce output before the log
      directory becomes writeable.
    (LP: #1096531).
-- 
https://code.launchpad.net/~jamesodhunt/upstart/bug-1096531/+merge/143314
Your team Upstart Reviewers is requested to review the proposed merge of 
lp:~jamesodhunt/upstart/bug-1096531 into lp:upstart.
=== modified file 'ChangeLog'
--- ChangeLog	2013-01-08 10:27:17 +0000
+++ ChangeLog	2013-01-15 14:01:32 +0000
@@ -1,3 +1,15 @@
+2013-01-15  James Hunt  <[email protected]>
+
+	* init/log.c:
+	  - log_clear_unflushed(): Correct remote_closed assertion to handle
+	    early-job-logging scenario where a job satisfies both of the
+	    following conditions:
+	    - ends before the log directory becomes writeable.
+	    - has spawned one or more processes that continue to run after the
+	      job itself has exited and which produce output before the log
+	      directory becomes writeable.
+	    (LP: #1096531).
+
 2013-01-04  Dmitrijs Ledkovs  <[email protected]>
 
 	* init/conf.c: add ability to apply override files from higher

=== modified file 'init/log.c'
--- init/log.c	2012-12-07 21:38:17 +0000
+++ init/log.c	2013-01-15 14:01:32 +0000
@@ -793,6 +793,11 @@
 		elem = (NihListEntry *)iter;
 		log = elem->data;
 
+		/* To be added to this list, log should have been
+		 * detached from its parent job.
+		 */
+		nih_assert (log->detached);
+
 		/* We expect 'an' error (as otherwise why would the log be
 		 * in this list?), but don't assert EROFS specifically
 		 * as a precaution (since an attempt to flush the log at
@@ -800,9 +805,19 @@
 		 */
 		nih_assert (log->open_errno);
 
-		nih_assert (log->unflushed->len);
-		nih_assert (log->remote_closed);
-		nih_assert (log->detached);
+		if (log->remote_closed) {
+			/* Parent job has ended and unflushed data
+			 * exists.
+			 */
+			nih_assert (log->unflushed->len && ! log->io);
+		} else {
+			/* Parent job itself has ended, but job spawned one or
+			 * more processes that are still running and
+			 * which might still produce output (the error
+			 * handler has therefore not been called).
+			 */
+			nih_assert (log->io);
+		}
 
 		if (log_file_open (log) != 0)
 			return -1;
@@ -810,6 +825,7 @@
 		if (log_file_write (log, NULL, 0) < 0)
 			return -1;
 
+		/* This will handle any remaining unflushed log data */
 		nih_free (log);
 	}
 

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to