Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Print a message for cycles in the graph when computing the target fin…
…gerprint While hand editing a BUILD file I introduced a cycle in the graph. The error was: ``` 21:35:47 00:03 [complete] FAILURE Exception caught: (<class 'pants.invalidation.cache_manager.CacheValidationError'>) Exception message: Problem validating target project.tests.src.test.proto.proto in project/tests/src/test/proto: maximum recursion depth exceeded ``` The stack trace showed: ``` ... File "pantsbuild.pants-1.1.0_pre6_square_20160707_01-py2-none-any.whl/pan ts/build_graph/target.py", line 464, in dep_hash_iter dep_hash = dep.transitive_invalidation_hash(fingerprint_strategy) File "pantsbuild.pants-1.1.0_pre6_square_20160707_01-py2-none-any.whl/pan ts/build_graph/target.py", line 467, in transitive_invalidation_hash dep_hashes = sorted(list(dep_hash_iter())) ... ``` This patch fixes it by trakcing the depth of these recursive calls and abort with an AddressLookupError so that we can see a trace. Now the error looks like: ``` Exception caught: (<class 'pants.invalidation.cache_manager.CacheValidationError'>) Exception message: Problem validating target service.container.tests.src.test.proto.proto in service/container/tests/src/test/proto: Max depth of 300 exceeded. referenced from 3rdparty:com.google.inject.guice referenced from otherproject/components/cronjobs/annotations/src/main/java:lib referenced from otherproject/components/cronjobs/annotations/src/main/java:cron-jobs-processor referenced from otherproject/components/cronjobs/annotations/src/main/java:lib referenced from otherproject/components/cronjobs/annotations/src/main/java:cron-jobs-processor referenced from otherproject/components/cronjobs/annotations/src/main/java:lib ... ``` Testing Done: Added unit test. CI running at https://travis-ci.org/pantsbuild/pants/builds/145436454 Bugs closed: 3681 Reviewed at https://rbcommons.com/s/twitter/r/4087/
- Loading branch information