Homec4science

Fix a bug where an ExecFuture might hang on __destruct() if its process holds…

Authored by epriestley <git@epriestley.com> on Dec 30 2012, 22:43.

Description

Fix a bug where an ExecFuture might hang on __destruct() if its process holds pipes

Summary:
I don't have a complete understanding of exactly what's going on here, but here's what I have been able to determine:

  • ExecFuture has a long-standing bug where it may hang indefinitely in __destruct() if the other process holds pipes open, even though ExecFuture has closed the pipes.
    • The new unit test reproduces this behavior.
    • Mystery: I don't know why closing the pipes from our side isn't good enough.
  • D4228 changed PhutilSocketChannel, which would previously tear down both pipes when either closed. Now it tears down only one pipe.
    • Mystery: I'm not sure which pipe dies and which stays alive.
  • This exposed T2248, where the remaining pipe kept the parent open and hanging in ExecFuture::__destruct().

Test Plan:
Added unit test, which failed. Made patch. Ran unit tests; tests passed.

Reproduced T2248 and ran "arc unit"; worked properly after this patch.

Reviewers: btrahan, vrana, ender, nh

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2248

Differential Revision: https://secure.phabricator.com/D4292

Details

Committed
epriestley <git@epriestley.com>Dec 30 2012, 22:43
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU8bccf69c7614: Improve handling of gigantic CommandExceptions
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHU676009778bd2: Fix a bug where an ExecFuture might hang on __destruct() if its process holds… (authored by epriestley <git@epriestley.com>).Dec 30 2012, 22:43