Homec4science

Fix some daemon errors related to multiple/out-of-order events

Authored by epriestley <git@epriestley.com> on May 26 2016, 03:09.

Description

Fix some daemon errors related to multiple/out-of-order events

Summary:
Ref T10811. Currently, we can emit the "willExit" event multiple times, or emit it and then emit a "log" event.

This causes some problems with the Phabricator listener, which cleans up resources the first time it sees this event. When it gets the second copy (or logs afterward) it fails to process events.

Instead, emit it only once we're actually cleaning up the daemon handle. This guarantees it emits last and emits exactly once.

I believe this only cleans up logs, but it's possible it also improves stability.

Test Plan:
You can reproduce this issue like this:

  • Run bin/phd debug hangforever.
  • Kill it with ^C^C.
  • Most of the time, it will emit errors.

With --trace, you can see additional information. After this patch, it no longer emits errors but still successfully marks the daemon as exited, and the willExit event is always emitted exactly once and emitted last.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10811

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

Details

Committed
epriestley <git@epriestley.com>May 26 2016, 17:08
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU1d216e95b39c: Provide locale support for languages we've seen translations for
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHU05e30630a4d3: Fix some daemon errors related to multiple/out-of-order events (authored by epriestley <git@epriestley.com>).May 26 2016, 17:08