Start the timeout *after* the process is spawned, drop the mutable process handler variable

Review Request #3202 - Created Dec. 2, 2015 and submitted

Information
Sameer Brenn
pants
Reviewers
pants-reviews
benjyw, stuhood

Pants in source at Twitter has a relatively long gap between when the timeout timer is started and when the actual test runner process was launched, which meant that if a timeout (<30s) ran its course before the test runner process was launched, it would not be aborted, then it would launch, and run for however long.

This fixes that, primarily by refactoring per Benjy's suggestion in the prior RB, whereby the "spawn" returns a process handle that can then be used to kill/terminate, etc, and then the timeout wraps just the wait, rather than the spawn & wait.

Abstracting out the process spawner a bit could help a little with moving towards distributed test running, but may be mooted by the engine refactor.

Succeed:

./pants test tests/python/pants_test/backend/jvm/tasks:junit_run
./pants test tests/python/pants_test/backend/python/tasks:pytest_run
./pants test tests/python/pants_test/backend/python/tasks:pytest_run_integration
./pants test tests/python/pants_test/backend/jvm/tasks:junit_run_integration
./pants test tests/python/pants_test/task:testrunner_task_mixin
./pants test tests/python/pants_test/util:process_handler
build-support/bin/unit-test.sh

Ran a test to ensure output from Junit shows up:
./pants test --test-junit-output-mode=ALL testprojects/src/java/org/pantsbuild/testproject/junit/suppressoutput:tests

Added some timeouts and sleeps and saw these fail:

./pants test tests/python/pants_test/util:xml_parser
./pants test tests/java/org/pantsbuild/testing

Added a sleep(60) to PytestRun._do_run_tests inside the self._test_runner context to simulate Twitter python pants test launching slowness, set timeout=5 on util:xml_parser test:
./pants test tests/python/pants_test/util:xml_parser

Added sleep(10) to the util:xml_parser test to force a failure (with the above sleep still in there to continue to simulate Twitter python pants test launching slowness):
./pants test tests/python/pants_test/util:xml_parser

Added a sleep to EasyMockTest and did ^C during the run:
./pants test tests/java/org/pantsbuild/testing
saw ABORTED:

11:09:30 00:01       [run]
                     Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
                     Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0
                     Auto-detected 8 processors, using -parallel-threads=8
                     ..^CINFO] killing nailgun server pid=97424
INFO] killing nailgun server pid=97426
INFO] killing nailgun server pid=98026

11:09:32 00:03   [complete]
               ABORTED

Travis: https://travis-ci.org/pantsbuild/pants/builds/100476390

Issues

  • 0
  • 17
  • 3
  • 20
Description From Last Updated
Sameer Brenn
Benjy Weinberger
Justin Trobec
Sameer Brenn
Benjy Weinberger
Benjy Weinberger
Sameer Brenn
Sameer Brenn
Sameer Brenn
Benjy Weinberger
Sameer Brenn
Benjy Weinberger
Sameer Brenn
Sameer Brenn
Sameer Brenn
Sameer Brenn
Benjy Weinberger
Benjy Weinberger
Benjy Weinberger
Benjy Weinberger
Sameer Brenn
Sameer Brenn
Nick Howard (Twitter)
Benjy Weinberger
Benjy Weinberger
Nick Howard (Twitter)
Sameer Brenn
Sameer Brenn
Sameer Brenn
Benjy Weinberger
Sameer Brenn
Review request changed

Status: Closed (submitted)

Change Summary:

Thanks Benjy and Nick for your help with this!

Loading...