This is an archive of the discontinued LLVM Phabricator instance.

Mark the execution of commands in stop hooks as non-interactive
ClosedPublic

Authored by jingham on Oct 28 2020, 12:16 PM.

Details

Summary

stop-hooks were not intended to be interactive, that would be really confusing when there are many in flight. So this patch marks the results as non-interactive.

Beyond correctness, then main reason for doing this patch is that when you go to run a command based stop hook that includes a Python command, if the command is marked as interactive, Python would try to act on stdin (fflush it) when switching to the Python Session, and if stdin was backed by an lldb NativeFile, the the fflush would deadlock against the I/O handler thread that was sitting in read on the same file handle.

That is a more general problem that this patch does not address. The only place it has shown up IRL is in this scenario, and since doing the right thing for the stop-hook execution works around it, the more general fix can wait on somebody else's free time. But I did add a test that will deadlock without this patch, and succeeds with it.

Diff Detail

Event Timeline

jingham created this revision.Oct 28 2020, 12:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2020, 12:16 PM
jingham requested review of this revision.Oct 28 2020, 12:16 PM
This revision was not accepted when it landed; it landed in state Needs Review.Oct 29 2020, 2:42 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.