New issue
Advanced search Search tips

Issue 818834 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

Partially output posinst log or have postinst to have its own log

Project Member Reported by ahass...@chromium.org, Mar 5 2018

Issue description

If the postinst causes a system reboot or hangs, the update_engine will never get its output log. So it maybe better for UE to partially output whatever log it got from postinst subprocess or allow to postinst to have its have its own log file.
 
Cc: jwer...@chromium.org vapier@chromium.org
if the system reboots unexpectedly, i'm not sure writing to our own log directly would be that more reliable.  iirc, on ext4, unexpected reboots tend to lead to data loss (while maintaining metadata consistency).

how is UE running postinst today ?  is it creating a pipe and having postinst write stdout/stderr to that ?  if so, having UE poll that pipe sounds fine.
Yes, I think that's how postinst is run in UE.
if we need to change postinst so that its output is not buffered (beyond line buffering), that should be fine (assuming it's not already)
Note that in the case we were seeing the system actually shut down cleanly, and update-engine exited cleanly due to some sort of shutdown notification (SIGTERM, I presume?). So at the very least we should write out whatever output we have in that case. If we can instead write the output to an O_SYNC log as soon as we get it or fsync the file manually after every written line, that would be even better.
Project Member

Comment 6 by bugdroid1@chromium.org, Mar 24 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/aosp/platform/system/update_engine/+/a8859544800a383dcad8bd9d2196523a68d5497e

commit a8859544800a383dcad8bd9d2196523a68d5497e
Author: Amin Hassani <ahassani@chromium.org>
Date: Sat Mar 24 00:29:30 2018

update_engine: Log output of alive subprocesses on exit.

Currently if an update engine spawned subprocess (like postinst) shuts down the
system, the update engine does not include the logs it buffered for that
subprocess in its log and debugging will may become impossible. This patch logs
the buffered output of all alive subprocesses upon exit.

BUG= chromium:818834 
BUG=b:74120207
TEST=cros flashed and rebooted the system while UE was running postinst. Then
the postinst log was partially logged in the UE log.

Change-Id: I75035f14e310a43a087511daa2a674794e5f373e
Reviewed-on: https://chromium-review.googlesource.com/954327
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>

[modify] https://crrev.com/a8859544800a383dcad8bd9d2196523a68d5497e/common/subprocess.cc
[modify] https://crrev.com/a8859544800a383dcad8bd9d2196523a68d5497e/common/subprocess.h
[modify] https://crrev.com/a8859544800a383dcad8bd9d2196523a68d5497e/main.cc

Status: Fixed (was: Available)

Sign in to add a comment