From ab1abae59ccca2b5f1685ab7d279a0273ff9278b Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Mon, 30 Jan 2017 16:48:52 -0800 Subject: Avoid to call UI functions in child process ui_print uses a mutex to protect the critical section. And a forked child process may intialize the mutex inappropriatly, which leads to a hanging child process. So we shall avoid to call the UI functions in child process. Bug: 34769056 Test: fake ota on fugu failed as expected due to updater format mismatch. Change-Id: I81bc942a796878fac19cf712512092c2b0d807c9 --- install.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install.cpp b/install.cpp index 959a74222..91e4875cb 100644 --- a/install.cpp +++ b/install.cpp @@ -382,7 +382,11 @@ static int try_update_binary(const char* path, ZipArchiveHandle zip, bool* wipe_ umask(022); close(pipefd[0]); execv(chr_args[0], const_cast(chr_args)); - PLOG(ERROR) << "Can't run " << chr_args[0]; + // Bug: 34769056 + // We shouldn't use LOG/PLOG in the forked process, since they may cause + // the child process to hang. This deadlock results from an improperly + // copied mutex in the ui functions. + fprintf(stdout, "E:Can't run %s (%s)\n", chr_args[0], strerror(errno)); _exit(-1); } close(pipefd[1]); -- cgit v1.2.3