Ádám Bakai has uploaded this change for review. ( http://gerrit.cloudera.org:8080/22056
Change subject: [subprocess] KUDU-3624 Fix DoWait thread-safety ...................................................................... [subprocess] KUDU-3624 Fix DoWait thread-safety Waitpid does return with an error if it is called with a pid that was already shut down. So Subprocess::DoWait stores the return value of previous waitpid execution and returns it instead of running it again. But in EchoSubprocessTest.TestSubprocessMetricsOnError it can happen that SubprocessServer::ExitCheckerThread() and Subprocess::KillAndWait both call Subprocess::DoWait and both of them call waitpid. And if ExitCheckerThread calls it second, then it fails a check. To fix this behaviour, wait_mutex_ is added. If a thread runs and evaluates waitpid, other threads won't execute it in the same time. If locking is unsucesful but the WaitMode is NON_BLOCKING, then return as if nothing happened. Change-Id: I1cb540860b439c26e1c8529123c8b29940d9f84f --- M src/kudu/util/subprocess.cc M src/kudu/util/subprocess.h 2 files changed, 25 insertions(+), 0 deletions(-) git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/56/22056/1 -- To view, visit http://gerrit.cloudera.org:8080/22056 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I1cb540860b439c26e1c8529123c8b29940d9f84f Gerrit-Change-Number: 22056 Gerrit-PatchSet: 1 Gerrit-Owner: Ádám Bakai <[email protected]>
