You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Alexey Serbin (Code Review)" <ge...@cloudera.org> on 2019/03/13 03:16:27 UTC

[kudu-CR] [subprocess] use RAW LOG() in child process

Alexey Serbin has uploaded this change for review. ( http://gerrit.cloudera.org:8080/12739


Change subject: [subprocess] use RAW_LOG() in child process
......................................................................

[subprocess] use RAW_LOG() in child process

Ideally, in the phase between fork() and exec() for a newly forked
process only async-signal safe functions should be called.  At least,
LOG() should not be called since it involves taking a lock while
flushing the message into the log sink.  Otherwise, the child process
can deadlock on attempt to write a log message via GLOG if the glog's
mutex has been copied from the parent's address space in locked state.

TODO: add a test scenario to simulate the deadlock and make sure
      it passes with this patch

Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
---
M src/kudu/util/signal.cc
M src/kudu/util/subprocess.cc
2 files changed, 57 insertions(+), 17 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/39/12739/1
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>

[kudu-CR] KUDU-2743 [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/12739 )

Change subject: KUDU-2743 [subprocess] use RAW_LOG() in child process
......................................................................

KUDU-2743 [subprocess] use RAW_LOG() in child process

For a newly fork()-ed, but not yet exec()-ed process, only async-signal
safe functions should be called.  At least, glog's LOG() should not be
called since it involves acquiring a lock while flushing the message
into the log sink.  Otherwise, the child process can deadlock on attempt
to write a log message if glog's mutex has been copied from the parent's
address space in a locked state.

Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Reviewed-on: http://gerrit.cloudera.org:8080/12739
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Alexey Serbin <as...@cloudera.com>
---
M src/kudu/util/signal.cc
M src/kudu/util/subprocess-test.cc
M src/kudu/util/subprocess.cc
3 files changed, 78 insertions(+), 20 deletions(-)

Approvals:
  Adar Dembo: Looks good to me, approved
  Alexey Serbin: Verified

-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 10
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>

[kudu-CR] KUDU-2743 [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Will Berkeley, Adar Dembo, Todd Lipcon, 

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

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

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

Change subject: KUDU-2743 [subprocess] use RAW_LOG() in child process
......................................................................

KUDU-2743 [subprocess] use RAW_LOG() in child process

For a newly fork()-ed, but not yet exec()-ed process, only async-signal
safe functions should be called.  At least, glog's LOG() should not be
called since it involves acquiring a lock while flushing the message
into the log sink.  Otherwise, the child process can deadlock on attempt
to write a log message if glog's mutex has been copied from the parent's
address space in a locked state.

Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
---
M src/kudu/util/signal.cc
M src/kudu/util/subprocess-test.cc
M src/kudu/util/subprocess.cc
3 files changed, 78 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/39/12739/8
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 8
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>

[kudu-CR] KUDU-2743 [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has removed Kudu Jenkins from this change.  ( http://gerrit.cloudera.org:8080/12739 )

Change subject: KUDU-2743 [subprocess] use RAW_LOG() in child process
......................................................................


Removed reviewer Kudu Jenkins with the following votes:

* Verified-1 by Kudu Jenkins (120)
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: deleteReviewer
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 8
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change. ( http://gerrit.cloudera.org:8080/12739 )

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................


Patch Set 1:

(7 comments)

http://gerrit.cloudera.org:8080/#/c/12739/1//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/12739/1//COMMIT_MSG@16
PS1, Line 16: TODO: add a test scenario to simulate the deadlock and make sure
            :       it passes with this patch
Maybe a loop that calls Subprocess::Call() on a non-existent program, and another thread that loops on a LOG() call?


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/signal.cc
File src/kudu/util/signal.cc:

http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/signal.cc@43
PS1, Line 43: // We unblock all signal masks since they are inherited.
Maybe note that the use of RAW_LOG is so that the function remains async-signal-safe?


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/signal.cc@48
PS1, Line 48:     RAW_LOG(FATAL, "sigfillset() failed: [%i]", err);
One of the other nice things that PCHECK/PLOG do is convert errno into a textual representation via glog's internal StrError (which uses strerror_r under the hood). Not saying we should necessarily do that here, just wanted to point it out.


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/subprocess.cc
File src/kudu/util/subprocess.cc:

http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/subprocess.cc@377
PS1, Line 377: generic
general


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/subprocess.cc@378
PS1, Line 378: In particular, trying
             :     // to log anything via GLOG involves taking a lock on mutex that might be
             :     // copied over from the parent in already locked state, so the child would
             :     // deadlock while doing to log anything using LOG() macro
Nit: reword as "Surprisingly, a call to LOG() locks a mutex that may have been copied from the parent's address space in an already locked state, so it is not async-signal-safe and can deadlock the child if called."


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/subprocess.cc@383
PS1, Line 383: it's not async-signal-safe
             :     // strictly speaking
The async-signal-safe documentation agrees with this, but I don't understand why: does vsnprintf have static state?


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/subprocess.cc@385
PS1, Line 385: the
drop 'the'



-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>
Gerrit-Comment-Date: Wed, 13 Mar 2019 04:07:00 +0000
Gerrit-HasComments: Yes

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Will Berkeley, Kudu Jenkins, Adar Dembo, 

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

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

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

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................

[subprocess] use RAW_LOG() in child process

For a newly fork()-ed, but not yet exec()-ed process, only async-signal
safe functions should be called.  At least, glog's LOG() should not be
called since it involves acquiring a lock while flushing the message
into the log sink.  Otherwise, the child process can deadlock on attempt
to write a log message if glog's mutex has been copied from the parent's
address space in a locked state.

Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
---
M src/kudu/util/signal.cc
M src/kudu/util/subprocess-test.cc
M src/kudu/util/subprocess.cc
3 files changed, 76 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/39/12739/6
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 6
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Will Berkeley, Adar Dembo, Todd Lipcon, 

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

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

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

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................

[subprocess] use RAW_LOG() in child process

For a newly fork()-ed, but not yet exec()-ed process, only async-signal
safe functions should be called.  At least, glog's LOG() should not be
called since it involves acquiring a lock while flushing the message
into the log sink.  Otherwise, the child process can deadlock on attempt
to write a log message if glog's mutex has been copied from the parent's
address space in a locked state.

Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
---
M src/kudu/util/signal.cc
M src/kudu/util/subprocess-test.cc
M src/kudu/util/subprocess.cc
3 files changed, 78 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/39/12739/7
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 7
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Will Berkeley, Kudu Jenkins, Adar Dembo, 

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

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

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

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................

[subprocess] use RAW_LOG() in child process

For a newly fork()-ed, but not yet exec()-ed process, only async-signal
safe functions should be called.  At least, glog's LOG() should not be
called since it involves acquiring a lock while flushing the message
into the log sink.  Otherwise, the child process can deadlock on attempt
to write a log message if glog's mutex has been copied from the parent's
address space in a locked state.

Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
---
M src/kudu/util/signal.cc
M src/kudu/util/subprocess-test.cc
M src/kudu/util/subprocess.cc
3 files changed, 75 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/39/12739/5
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 5
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/12739 )

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................


Patch Set 6:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/12739/6/src/kudu/util/signal.cc
File src/kudu/util/signal.cc:

http://gerrit.cloudera.org:8080/#/c/12739/6/src/kudu/util/signal.cc@40
PS6, Line 40: %i]
> nit: was surprised to see %i here. Apparently %i and %d are synonymous but 
Done


http://gerrit.cloudera.org:8080/#/c/12739/6/src/kudu/util/subprocess.cc
File src/kudu/util/subprocess.cc:

http://gerrit.cloudera.org:8080/#/c/12739/6/src/kudu/util/subprocess.cc@384
PS6, Line 384:     // strictly speaking (might call malloc() and getenv() in some cases which
> at least in tcmalloc, I'm pretty sure malloc-after-fork is safe due to it i
Thanks -- I added this information into the comment.



-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 6
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>
Gerrit-Comment-Date: Wed, 13 Mar 2019 17:20:33 +0000
Gerrit-HasComments: Yes

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/12739 )

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................


Patch Set 7: Verified+1

unrelated flake in OptionalSSL/TestRpc.TestClientConnectionMetrics/0


-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 7
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>
Gerrit-Comment-Date: Wed, 13 Mar 2019 17:48:41 +0000
Gerrit-HasComments: No

[kudu-CR] KUDU-2743 [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Will Berkeley, Adar Dembo, Todd Lipcon, 

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

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

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

Change subject: KUDU-2743 [subprocess] use RAW_LOG() in child process
......................................................................

KUDU-2743 [subprocess] use RAW_LOG() in child process

For a newly fork()-ed, but not yet exec()-ed process, only async-signal
safe functions should be called.  At least, glog's LOG() should not be
called since it involves acquiring a lock while flushing the message
into the log sink.  Otherwise, the child process can deadlock on attempt
to write a log message if glog's mutex has been copied from the parent's
address space in a locked state.

Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
---
M src/kudu/util/signal.cc
M src/kudu/util/subprocess-test.cc
M src/kudu/util/subprocess.cc
3 files changed, 78 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/39/12739/9
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 9
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/12739 )

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................


Patch Set 1:

(7 comments)

http://gerrit.cloudera.org:8080/#/c/12739/1//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/12739/1//COMMIT_MSG@16
PS1, Line 16: TODO: add a test scenario to simulate the deadlock and make sure
            :       it passes with this patch
> Maybe a loop that calls Subprocess::Call() on a non-existent program, and a
Yep, it's done: https://gerrit.cloudera.org/#/c/12740/


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/signal.cc
File src/kudu/util/signal.cc:

http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/signal.cc@43
PS1, Line 43: // We unblock all signal masks since they are inherited.
> Maybe note that the use of RAW_LOG is so that the function remains async-si
it's almost safe, yep: vsnprintf() might call malloc, it seems.  Added the comment.


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/signal.cc@48
PS1, Line 48:     RAW_LOG(FATAL, "sigfillset() failed: [%i]", err);
> One of the other nice things that PCHECK/PLOG do is convert errno into a te
Right, I specifically omitted that part because of absence of async-signal-safe guaranties for strerror: http://www.man7.org/linux/man-pages/man7/signal-safety.7.html


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/subprocess.cc
File src/kudu/util/subprocess.cc:

http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/subprocess.cc@377
PS1, Line 377: generic
> general
Done


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/subprocess.cc@378
PS1, Line 378: In particular, trying
             :     // to log anything via GLOG involves taking a lock on mutex that might be
             :     // copied over from the parent in already locked state, so the child would
             :     // deadlock while doing to log anything using LOG() macro
> Nit: reword as "Surprisingly, a call to LOG() locks a mutex that may have b
Thanks, that sounds clearer.  Done.


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/subprocess.cc@383
PS1, Line 383: it's not async-signal-safe
             :     // strictly speaking
> The async-signal-safe documentation agrees with this, but I don't understan
It seems the implementation might call malloc() in some cases.  I added the note.


http://gerrit.cloudera.org:8080/#/c/12739/1/src/kudu/util/subprocess.cc@385
PS1, Line 385: the
> drop 'the'
Done



-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>
Gerrit-Comment-Date: Wed, 13 Mar 2019 05:51:34 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-2743 [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/12739 )

Change subject: KUDU-2743 [subprocess] use RAW_LOG() in child process
......................................................................


Patch Set 8: Verified+1

unrelated flake in ToolTest.TestScanTableProjection


-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 8
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>
Gerrit-Comment-Date: Wed, 13 Mar 2019 20:30:58 +0000
Gerrit-HasComments: No

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/12739 )

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................


Patch Set 6: Verified+1

unrelated flake in StopTablets/StopTabletITest.TestStoppedTabletsDontWrite/0


-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 6
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>
Gerrit-Comment-Date: Wed, 13 Mar 2019 15:42:02 +0000
Gerrit-HasComments: No

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Will Berkeley, Kudu Jenkins, Adar Dembo, 

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

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

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

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................

[subprocess] use RAW_LOG() in child process

Ideally, in the phase between fork() and exec() for a newly forked
process only async-signal safe functions should be called.  At least,
LOG() should not be called since it involves taking a lock while
flushing the message into the log sink.  Otherwise, the child process
can deadlock on attempt to write a log message via GLOG if the glog's
mutex has been copied from the parent's address space in locked state.

Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
---
M src/kudu/util/signal.cc
M src/kudu/util/subprocess-test.cc
M src/kudu/util/subprocess.cc
3 files changed, 75 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/39/12739/3
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 3
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Will Berkeley, Kudu Jenkins, Adar Dembo, 

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

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

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

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................

[subprocess] use RAW_LOG() in child process

For a newly fork()-ed, but not yet exec()-ed process, only async-signal
safe functions should be called.  At least, glog's LOG() should not be
called since it involves acquiring a lock while flushing the message
into the log sink.  Otherwise, the child process can deadlock on attempt
to write a log message if glog's mutex has been copied from the parent's
address space in a locked state.

Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
---
M src/kudu/util/signal.cc
M src/kudu/util/subprocess-test.cc
M src/kudu/util/subprocess.cc
3 files changed, 75 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/39/12739/4
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 4
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change. ( http://gerrit.cloudera.org:8080/12739 )

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................


Patch Set 7: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 7
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>
Gerrit-Comment-Date: Wed, 13 Mar 2019 18:43:59 +0000
Gerrit-HasComments: No

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change. ( http://gerrit.cloudera.org:8080/12739 )

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................


Patch Set 6:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/12739/6/src/kudu/util/signal.cc
File src/kudu/util/signal.cc:

http://gerrit.cloudera.org:8080/#/c/12739/6/src/kudu/util/signal.cc@40
PS6, Line 40: %i]
nit: was surprised to see %i here. Apparently %i and %d are synonymous but %d is a lot more commonly used in my experience. Mind changing it just so it looks more "standard"?  (same below)


http://gerrit.cloudera.org:8080/#/c/12739/6/src/kudu/util/subprocess.cc
File src/kudu/util/subprocess.cc:

http://gerrit.cloudera.org:8080/#/c/12739/6/src/kudu/util/subprocess.cc@384
PS6, Line 384:     // strictly speaking (might call malloc() and getenv() in some cases which
at least in tcmalloc, I'm pretty sure malloc-after-fork is safe due to it installing an atfork handler to lock the mutex prior to fork and unlock it after fork:

  perftools_pthread_atfork(
    CentralCacheLockAll,    // parent calls before fork
    CentralCacheUnlockAll,  // parent calls after fork
    CentralCacheUnlockAll); // child calls after fork



-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 6
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>
Gerrit-Comment-Date: Wed, 13 Mar 2019 16:14:36 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-2743 [subprocess] use RAW LOG() in child process

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change. ( http://gerrit.cloudera.org:8080/12739 )

Change subject: KUDU-2743 [subprocess] use RAW_LOG() in child process
......................................................................


Patch Set 8: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 8
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>
Gerrit-Comment-Date: Wed, 13 Mar 2019 19:13:27 +0000
Gerrit-HasComments: No

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Will Berkeley, Kudu Jenkins, Adar Dembo, 

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

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

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

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................

[subprocess] use RAW_LOG() in child process

Ideally, in the phase between fork() and exec() for a newly forked
process only async-signal safe functions should be called.  At least,
LOG() should not be called since it involves taking a lock while
flushing the message into the log sink.  Otherwise, the child process
can deadlock on attempt to write a log message via GLOG if the glog's
mutex has been copied from the parent's address space in locked state.

TODO: the test from the prior changelists stil fails, but with different
      scenario of locking: I'm planning to address that shortly

Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
---
M src/kudu/util/signal.cc
M src/kudu/util/subprocess.cc
2 files changed, 57 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/39/12739/2
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has removed Kudu Jenkins from this change.  ( http://gerrit.cloudera.org:8080/12739 )

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................


Removed reviewer Kudu Jenkins with the following votes:

* Verified-1 by Kudu Jenkins (120)
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: deleteReviewer
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 6
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>

[kudu-CR] [subprocess] use RAW LOG() in child process

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has removed Kudu Jenkins from this change.  ( http://gerrit.cloudera.org:8080/12739 )

Change subject: [subprocess] use RAW_LOG() in child process
......................................................................


Removed reviewer Kudu Jenkins with the following votes:

* Verified-1 by Kudu Jenkins (120)
-- 
To view, visit http://gerrit.cloudera.org:8080/12739
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: deleteReviewer
Gerrit-Change-Id: Ic9dca4ca8b1a6d72c9fc818ea41109c80ace3e39
Gerrit-Change-Number: 12739
Gerrit-PatchSet: 7
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Will Berkeley <wd...@gmail.com>