Hello Alexey Serbin, Ashwani Raina, Kudu Jenkins,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/22056

to look at the new patch set (#3).

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 the following check:
server.cc:401] Check failed: _s.ok() Bad status: Runtime error: Unable
to wait on child: No child processes (error 10)

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 unsuccessful but the WaitMode is NON_BLOCKING, then return as
if nothing happened.  Unit test SubprocessTest.TestMultiThreadWait
was added to verify executing two wait commands parallelly.

Change-Id: I1cb540860b439c26e1c8529123c8b29940d9f84f
---
M src/kudu/util/subprocess-test.cc
M src/kudu/util/subprocess.cc
M src/kudu/util/subprocess.h
3 files changed, 26 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/56/22056/3
--
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: newpatchset
Gerrit-Change-Id: I1cb540860b439c26e1c8529123c8b29940d9f84f
Gerrit-Change-Number: 22056
Gerrit-PatchSet: 3
Gerrit-Owner: Ádám Bakai <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Ashwani Raina <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Ádám Bakai <[email protected]>

Reply via email to