#1336 assigned defect

improve the mechanism that causes test nodes to exit even if not successfully stopped

Reported by: davidsarah Owned by: daira
Priority: major Milestone: undecided
Component: code Version: 1.8.1
Keywords: cleanup test Cc:
Launchpad Bug:

Description (last modified by daira)

src/allmydata/test/test_runner.py includes some tests (in the RunNode class) for whether node processes can be successfully started and stopped. If stopping the node fails, we don't want the node process to be left running. (On Windows the process would hold open file handles that prevent the _trial_test directory from being deleted, interfering with subsequent test runs -- although currently these tests don't work on Windows anyway, as discussed below.)

Currently this is done by writing a file, with the poorly-chosen name "suicide_prevention_hotline" called "exit_trigger", in the node directory. If a node sees this file at startup, it will set a 1-second periodic timer (src/allmydata/client.py#L161) that each time it triggers, causes the node process to exit if either the file's mtime is more than 120 seconds ago, or the file no longer exists (src/allmydata/client.py#L498).

There are several problems with this mechanism:

  • On slow machines, the node process may exit before the test had chance to stop it, causing a spurious test failure. This seems to be happening on the 'FranXois lenny-armv5tel' buildbot (example).
  • There is no way to distinguish an exit due to this cause from the process being killed or exiting for another reason.
  • The name of the file is based on a very poor choice of metaphor, that is both unpleasant and misleading. (The existence of the file doesn't prevent the node from exiting, as the name might imply.)

In addition, the tests of starting nodes don't work on Windows, because twistd doesn't daemonize or write the pid file on that platform. While that isn't directly due to this mechanism, it would be nice to redesign these tests in a way that does work on Windows (if we're not going to change the Windows behaviour to be more like Unix).

Change History (3)

comment:1 Changed at 2011-01-25T06:53:46Z by zooko

  • Owner changed from somebody to davidsarah

I would be happy to have these issues fixed. But how?

comment:2 Changed at 2014-08-17T15:05:57Z by daira

  • Description modified (diff)
  • Owner changed from davidsarah to daira
  • Status changed from new to assigned

comment:3 Changed at 2014-08-17T15:09:58Z by daira

The name of the file was changed to "exit_trigger" in [647ebce6b993cc6d319ad6be0f4921909d159d73/trunk].

Note: See TracTickets for help on using tickets.