From bb7184163e6b6fcf1c1fbc41fd0000cf59918277 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 7 Apr 2016 20:59:42 -1000 Subject: [PATCH] test/common: add a slight stall in tearDown 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. --- src/allmydata/test/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/allmydata/test/common.py b/src/allmydata/test/common.py index 6bf2f9743..17f6842a4 100644 --- a/src/allmydata/test/common.py +++ b/src/allmydata/test/common.py @@ -453,7 +453,8 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin): 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