diff options
author | David James <davidjames@google.com> | 2014-06-09 18:54:11 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-06-11 22:09:53 +0000 |
commit | 8319c4828196f90c20c7c309c3a0989c1c52f541 (patch) | |
tree | e865cce46f279669208fc23e7494371ab9445679 | |
parent | c60eb387383895ed8d30d67b093708b9de868e8f (diff) | |
download | chromite-8319c4828196f90c20c7c309c3a0989c1c52f541.tar.gz |
Set the SILENT_TIMEOUT to under 9000 seconds again, and explain why.
When SILENT_TIMEOUT is under 9000 seconds, then cbuildbot will catch
hanging processes before buildbot does. This allows cbuildbot to catch
hanging processes and to finish its work.
BUG=chromium:382739
TEST=All unit tests.
Change-Id: I5403a62971ff4b766c669bd95f7a47d8a47faefb
Reviewed-on: https://chromium-review.googlesource.com/203182
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
-rwxr-xr-x | cbuildbot/cbuildbot_config.py | 2 | ||||
-rwxr-xr-x | cbuildbot/cbuildbot_config_unittest.py | 13 | ||||
-rw-r--r-- | lib/parallel.py | 8 | ||||
-rwxr-xr-x | lib/parallel_unittest.py | 14 |
4 files changed, 19 insertions, 18 deletions
diff --git a/cbuildbot/cbuildbot_config.py b/cbuildbot/cbuildbot_config.py index dbb89a4b4..71253a84e 100755 --- a/cbuildbot/cbuildbot_config.py +++ b/cbuildbot/cbuildbot_config.py @@ -628,8 +628,6 @@ class HWTestConfig(object): Members: timeout: Number of seconds to wait before timing out waiting for results. - Defaults to 2 hours and ten minutes. This must be less than - lib.parallel._BackgroundTask.MINIMUM_SILENT_TIMEOUT. pool: Pool to use for hw testing. async: Fire-and-forget suite. warn_only: Failure on HW tests warns only (does not generate error). If set, diff --git a/cbuildbot/cbuildbot_config_unittest.py b/cbuildbot/cbuildbot_config_unittest.py index 2a46d1a88..b75024950 100755 --- a/cbuildbot/cbuildbot_config_unittest.py +++ b/cbuildbot/cbuildbot_config_unittest.py @@ -18,7 +18,6 @@ from chromite.lib import cros_build_lib from chromite.lib import cros_test_lib from chromite.lib import git from chromite.lib import osutils -from chromite.lib import parallel CHROMIUM_WATCHING_URL = ('http://src.chromium.org/chrome/trunk/tools/build/' 'masters/master.chromium.chromiumos/master_chromiumos_cros_cfg.py') @@ -224,18 +223,6 @@ class CBuildBotTest(cros_test_lib.MoxTestCase): "%s is trying to run hw tests without uploading payloads." % build_name) - def testHWTestTimeout(self): - """Verify that hw test timeout is in a reasonable range.""" - # The parallel library will kill the process if it's silent for longer - # than the silent timeout. - # pylint: disable=W0212 - max_timeout = parallel._BackgroundTask.SILENT_TIMEOUT - for build_name, config in cbuildbot_config.config.iteritems(): - for test_config in config['hw_tests']: - self.assertTrue(test_config.timeout < max_timeout, - '%s has a hw_tests_timeout of %s that is too large. Expected %s' % - (build_name, test_config.timeout, max_timeout)) - def testValidUnifiedMasterConfig(self): """Make sure any unified master configurations are valid.""" for build_name, config in cbuildbot_config.config.iteritems(): diff --git a/lib/parallel.py b/lib/parallel.py index f337e8c7f..028b1c28a 100644 --- a/lib/parallel.py +++ b/lib/parallel.py @@ -117,9 +117,11 @@ class _BackgroundTask(multiprocessing.Process): STARTUP_TIMEOUT = 60 * 5 EXIT_TIMEOUT = 60 * 10 - # TODO: crbug.com/360063 - # The time we allow processes to be silent. - SILENT_TIMEOUT = 60 * 230 + # The time we allow processes to be silent. This is in place so that we + # eventually catch hanging processes, and print the remainder of our output. + # Do not increase this. Instead, adjust your program to print regular progress + # updates, so that cbuildbot (and buildbot) can know that it has not hung. + SILENT_TIMEOUT = 60 * 145 # The amount by which we reduce the SILENT_TIMEOUT every time we launch # a subprocess. This helps ensure that children get a chance to enforce the diff --git a/lib/parallel_unittest.py b/lib/parallel_unittest.py index ef1cb2117..2c4c02628 100755 --- a/lib/parallel_unittest.py +++ b/lib/parallel_unittest.py @@ -440,6 +440,20 @@ class TestHalting(cros_test_lib.MockOutputTestCase, TestBackgroundWrapper): self.assertTrue(ex_str) +class TestConstants(cros_test_lib.TestCase): + """Test values of constants.""" + + def testSilentTimeout(self): + """Verify the silent timeout is small enough.""" + # Enforce that the default timeout is less than 9000, the default timeout + # set in build/scripts/master/factory/chromeos_factory.py:ChromiteFactory + # in the Chrome buildbot source code. + self.assertLess(parallel._BackgroundTask.SILENT_TIMEOUT, 9000, + 'Do not increase this timeout. Instead, print regular progress ' + 'updates, so that buildbot (and cbuildbot) will will know that your ' + 'program has not hung.') + + if __name__ == '__main__': # Run the tests. cros_test_lib.main(level=logging.INFO) |