Regarding #15, I'm not sure this is correct. As you say, when the job process terminates, job_process_terminated() gets called. This calls log_handle_unflushed() and that function calls log_read_watch(), which ultimately calls write(2). However, even if the write is successful before 'initctl notify-disk-writeable' gets called, if you look at log_handle_unflushed()...
So, if the write is successful and log->unflushed->len becomes zero, the function returns 1 (meaning "log does not need to be added to the unflushed list") and crucially the log is not added to the unflushed list.
Regarding #16, there shouldn't be a problem in that scenario since when the log gets added to the unflushed list, it is totally detached from its parent job. Hence, the job can be destroyed but the log lives on as an element of the unflushed list. If that job gets recreated, it will get a new set of log objects associated with it.
Did you manage to get the full log_clear_unflushed() debug output in the end?
Hi Ondrej,
Regarding #15, I'm not sure this is correct. As you say, when the job process terminates, job_process_ terminated( ) gets called. This calls log_handle_ unflushed( ) and that function calls log_read_watch(), which ultimately calls write(2). However, even if the write is successful before 'initctl notify- disk-writeable' gets called, if you look at log_handle_ unflushed( )...
743 log_handle_ unflushed (void *parent, Log *log) >len)
744 {
745 NihListEntry *elem;
746
747 nih_assert (log);
748 nih_assert (log->detached == 0);
749
750 log_read_watch (log);
751
752 if (! log->unflushed-
753 return 1;
So, if the write is successful and log->unflushed->len becomes zero, the function returns 1 (meaning "log does not need to be added to the unflushed list") and crucially the log is not added to the unflushed list.
Regarding #16, there shouldn't be a problem in that scenario since when the log gets added to the unflushed list, it is totally detached from its parent job. Hence, the job can be destroyed but the log lives on as an element of the unflushed list. If that job gets recreated, it will get a new set of log objects associated with it.
Did you manage to get the full log_clear_ unflushed( ) debug output in the end?