Skip to content

Commit

Permalink
test/common: add a slight stall in tearDown
Browse files Browse the repository at this point in the history
With the new Foolscap-0.11.0 (which changed the way connections are
established), I'm seeing DirtyReactorErrors getting thrown by
allmydata.test.test_system.SystemTest.test_filesystem_with_cli_in_subprocess
, on a host that has three IP addresses (one is 127.0.0.1, two is wifi,
three is a VPN). The test itself is getting skipped because bin/tahoe
isn't in the expected place, but by that point, the nodes have already
been launched and have established connections over one of the three
hints (probably 127.0.0.1). The test terminates so quickly that the
connections to the other two addresses have not finished being
abandoned. The extra stall seems to give Foolscap enough time to reap
the cancelled connections and makes the DRT go away.

I think an offline test, or maybe one with a single external IP address,
wouldn't hit this case.

Arbitrary stalls are never very satisfactory, of course. Usually there
is some threshold delay value, below which it fails reliably, above
which it works on my own machine (for now). This one is weird: the
threshold seems to be below the resolution of the system clock. Stalling
for one nanosecond was enough to fix the problem, but using a simple
fireEventually() didn't work.
  • Loading branch information
warner committed Apr 8, 2016
1 parent 8279d91 commit bb71841
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/allmydata/test/common.py
Expand Up @@ -453,7 +453,8 @@ def setUp(self):

def tearDown(self):
log.msg("shutting down SystemTest services")
d = self.sparent.stopService()
d = self.stall(0.001)
d.addCallback(lambda _: self.sparent.stopService())
d.addBoth(flush_but_dont_ignore)
return d

Expand Down

0 comments on commit bb71841

Please sign in to comment.