Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CacheCompileIntegrationWithZjarsTest's test_rsc_and_zinc_caching is flaky #9312

Closed
Eric-Arellano opened this issue Mar 16, 2020 · 1 comment

Comments

@Eric-Arellano
Copy link
Contributor

Spotted on March 16, 2020. I'm going to mark as flaky with 1 retry.

 ...F                                       [100%]
786                     ==================== FAILURES ====================
787                     _ CacheCompileIntegrationWithZjarsTest.test_rsc_and_zinc_caching _
788                     
789                     self = <pants_test.backend.jvm.tasks.jvm_compile.java.test_cache_compile_integration.CacheCompileIntegrationWithZjarsTest testMethod=test_rsc_and_zinc_caching>
790                     
791                         def test_rsc_and_zinc_caching(self):
792                             """Tests that with rsc-and-zinc, we write both artifacts."""
793                         
794                             srcfile1 = "A.scala"
795                             srcfile2 = "B.scala"
796                         
797                             def take_only_subdir(curdir, child_name=None):
798                                 children = os.listdir(curdir)
799                                 if child_name:
800                                     self.assertEqual(children, [child_name])
801                                 else:
802                                     self.assertEqual(len(children), 1)
803                                 child = children[0]
804                                 return os.path.join(curdir, child)
805                         
806                             def descend_subdirs(curdir, descendants):
807                                 if not descendants:
808                                     return curdir
809                                 nextdir = take_only_subdir(curdir, descendants[0])
810                                 return descend_subdirs(nextdir, descendants[1:])
811                         
812                             def work(compile, cache_test_subdirs):
813                                 def ensure_classfiles(target_name, classfiles):
814                                     cache_test_subdir = cache_test_subdirs[target_name]
815                                     cache_dir_entries = os.listdir(cache_test_subdir)
816                                     self.assertEqual(len(cache_dir_entries), 1)
817                                     cache_entry = cache_dir_entries[0]
818                         
819                                     with self.temporary_workdir() as cache_unzip_dir, self.temporary_workdir() as rsc_dir, self.temporary_workdir() as zinc_dir:
820                         
821                                         cache_path = os.path.join(cache_test_subdir, cache_entry)
822                                         TGZ.extract(cache_path, cache_unzip_dir)
823                                         # assert that the unzip dir has the directory structure
824                                         # ./compile/rsc/{hash}/{x}.{target_name}/{hash2}
825                                         path = descend_subdirs(cache_unzip_dir, ["compile", "rsc", None, None])
826                                         self.assertTrue(path.endswith(f".{target_name}"))
827                                         path = take_only_subdir(path)
828                         
829                                         # TODO: Surprisingly, rsc/m.jar is created even for dependee-less targets.
830                                         self.assertEqual(sorted(os.listdir(path)), ["rsc", "zinc"])
831                         
832                                         # Check that zinc/z.jar and rsc/m.jar both exist
833                                         # and that their contents contain the right classfiles
834                                         zincpath = os.path.join(path, "zinc")
835                                         zjar = os.path.join(zincpath, "z.jar")
836                                         self.assertTrue(os.path.exists(zjar))
837                                         ZIP.extract(zjar, zinc_dir)
838                                         self.assertEqual(
839                                             sorted(os.listdir(zinc_dir)), sorted(["compile_classpath", *classfiles])
840                                         )
841                         
842                                         rscpath = os.path.join(path, "rsc")
843                                         mjar = os.path.join(rscpath, "m.jar")
844                                         self.assertTrue(os.path.exists(mjar))
845                                         ZIP.extract(mjar, rsc_dir)
846                                         self.assertEqual(sorted(os.listdir(rsc_dir)), sorted(classfiles))
847                         
848                                 ensure_classfiles("cachetestA", ["A.class"])
849                                 ensure_classfiles("cachetestB", ["B.class"])
850                         
851                             config = {"compile.rsc": {"workflow": RscCompile.JvmCompileWorkflowType.rsc_and_zinc.value}}
852                             self._compile_spec(
853                                 [Compile({srcfile1: "class A {}", srcfile2: "class B {}"}, config, 1)],
854                                 [
855                                     "scala_library(name='cachetestA', sources=['A.scala'])",
856                                     "scala_library(name='cachetestB', sources=['B.scala'], dependencies=[':cachetestA'])",
857                                 ],
858                                 ["cachetestA", "cachetestB"],
859                                 "cachetestB",
860                     >           work,
861                             )
862                     
863                     pants_test/backend/jvm/tasks/jvm_compile/java/test_cache_compile_integration.py:362: 
864                     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
865                     pants_test/backend/jvm/tasks/jvm_compile/java/test_cache_compile_integration.py:412: in _compile_spec
866                         self.run_compile(spec, complete_config(c.config), workdir)
867                     pants_test/backend/jvm/tasks/jvm_compile/java/test_cache_compile_integration.py:31: in run_compile
868                         self.assert_success(pants_run)
869                     pants/testutil/pants_run_integration_test.py:515: in assert_success
870                         self.assert_result(pants_run, PANTS_SUCCEEDED_EXIT_CODE, expected=True, msg=msg)
871                     pants/testutil/pants_run_integration_test.py:536: in assert_result
872                         assertion(value, pants_run.returncode, error_msg)
873                     E   AssertionError: 0 != 1 : /opt/python/3.6.7/bin/python3.6 -m pants --no-pantsrc --pants-workdir=/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/.pants.d/tmp/tmpok3sj0aw.pants.d --print-exception-stacktrace=True --kill-nailguns --pants-config-files=/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/.pants.d/tmp/tmpok3sj0aw.pants.d/pants.toml compile /home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/tmp2m0tty7v/:cachetestB
874                     E   returncode: 1
875                     E   stdout:
876                     E   	
877                     E   	05:52:48 00:00 [main]
878                     E   	               (To run a reporting server: ./pants server)
879                     E   	05:52:50 00:02   [setup]
880                     E   	05:52:50 00:02     [parse]
881                     E   	               Executing tasks in goals: bootstrap -> imports -> unpack-wheels -> unpack-jars -> deferred-sources -> gen -> native-compile -> jvm-platform-validate -> resolve -> resources -> compile
882                     E   	05:52:50 00:02   [bootstrap]
883                     E   	05:52:50 00:02     [substitute-aliased-targets]
884                     E   	05:52:50 00:02     [jar-dependency-management]
885                     E   	05:52:50 00:02     [bootstrap-jvm-tools]
886                     E   	05:52:50 00:02     [provide-tools-jar]
887                     E   	05:52:50 00:02   [imports]
888                     E   	05:52:50 00:02     [ivy-imports]
889                     E   	05:52:50 00:02   [unpack-wheels]
890                     E   	05:52:50 00:02     [unpack-wheels]
891                     E   	05:52:51 00:03   [unpack-jars]
892                     E   	05:52:51 00:03     [unpack-jars]
893                     E   	05:52:51 00:03   [deferred-sources]
894                     E   	05:52:51 00:03     [deferred-sources]
895                     E   	05:52:51 00:03   [gen]
896                     E   	05:52:51 00:03     [antlr-java]
897                     E   	05:52:51 00:03     [antlr-py]
898                     E   	05:52:51 00:03     [jaxb]
899                     E   	05:52:51 00:03     [protoc]
900                     E   	05:52:51 00:03     [ragel]
901                     E   	05:52:51 00:03     [thrift-java]
902                     E   	05:52:51 00:03     [thrift-py]
903                     E   	05:52:51 00:03     [py-thrift-namespace-clash-check]
904                     E   	05:52:51 00:03     [grpcio-prep]
905                     E   	05:52:51 00:03     [grpcio-run]
906                     E   	05:52:51 00:03     [wire]
907                     E   	05:52:51 00:03     [avro-java]
908                     E   	05:52:51 00:03     [go-thrift]
909                     E   	05:52:51 00:03     [go-protobuf]
910                     E   	05:52:51 00:03     [jax-ws]
911                     E   	05:52:51 00:03     [scrooge]
912                     E   	05:52:51 00:03     [thrifty]
913                     E   	05:52:51 00:03   [native-compile]
914                     E   	05:52:51 00:03     [conan-prep]
915                     E   	05:52:51 00:03     [conan-fetch]
916                     E   	05:52:51 00:03     [c-for-ctypes]
917                     E   	05:52:51 00:03     [cpp-for-ctypes]
918                     E   	05:52:52 00:04   [jvm-platform-validate]
919                     E   	05:52:52 00:04     [jvm-platform-validate]
920                     E   	                   Invalidated 2 targets.
921                     E   	05:52:52 00:04   [resolve]
922                     E   	05:52:52 00:04     [ivy]
923                     E   	                   Invalidated 1 target.
924                     E   	05:52:52 00:04       [ivy-resolve]
925                     E   	05:52:53 00:05     [coursier]
926                     E   	05:52:53 00:05     [go]
927                     E   	05:52:53 00:05     [scala-js-compile]
928                     E   	05:52:53 00:05     [scala-js-link]
929                     E   	05:52:53 00:05     [node]
930                     E   	05:52:53 00:05   [resources]
931                     E   	05:52:53 00:05     [prepare]
932                     E   	05:52:53 00:05     [services]
933                     E   	05:52:53 00:05   [compile]
934                     E   	05:52:53 00:05     [node]
935                     E   	05:52:53 00:05     [compile-jvm-prep-command]
936                     E   	05:52:53 00:05       [jvm_prep_command]
937                     E   	05:52:53 00:05     [compile-prep-command]
938                     E   	05:52:53 00:05     [compile]
939                     E   	05:52:53 00:05     [rsc]
940                     E   	05:52:53 00:05       [cache]
941                     E   	                   No cached artifacts for 2 targets.
942                     E   	                   Invalidated 2 targets.
943                     E   	05:52:53 00:05       [isolation-mixed-pool-bootstrap]
944                     E   	                   [1/4] Rsc-ing 1 mixed source in 1 target (tmp2m0tty7v:cachetestA).
945                     E   	                   [2/4] Compiling 1 mixed source in 1 target (tmp2m0tty7v:cachetestA).
946                     E   	05:52:54 00:06       [compile]
947                     E   	                     
948                     E   	05:52:54 00:06         [cache]
949                     E   	                   rsc(tmp2m0tty7v:cachetestA) failed: Path for link would overwrite an existing directory: /home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/.pants.d/tmp/tmpok3sj0aw.pants.d/bootstrap/bootstrap-jvm-tools/current in 0.6423475742340088
950                     E   	                   Traceback:
951                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/jvm_compile/execution_graph.py", line 303, in worker
952                     E   	                       work()
953                     E   	                   
954                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/jvm_compile/execution_graph.py", line 59, in __call__
955                     E   	                       self.fn()
956                     E   	                   
957                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/jvm_compile/rsc/rsc_compile.py", line 574, in work_for_vts_rsc
958                     E   	                       self._runtool(distribution, input_digest, ctx, use_youtline)
959                     E   	                   
960                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/jvm_compile/rsc/rsc_compile.py", line 1036, in _runtool
961                     E   	                       tool_classpath = self._rsc_classpath
962                     E   	                   
963                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/util/memo.py", line 123, in memoize
964                     E   	                       result = func(*args, **kwargs)
965                     E   	                   
966                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/jvm_compile/rsc/rsc_compile.py", line 265, in _rsc_classpath
967                     E   	                       return self.tool_classpath("rsc")
968                     E   	                   
969                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/jvm_tool_task_mixin.py", line 56, in tool_classpath
970                     E   	                       self.context.products, key, scope=self._scope(scope)
971                     E   	                   
972                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/subsystems/jvm_tool_mixin.py", line 236, in tool_classpath_from_products
973                     E   	                       entry.path for entry in cls.tool_classpath_entries_from_products(products, key, scope)
974                     E   	                   
975                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/subsystems/jvm_tool_mixin.py", line 254, in tool_classpath_entries_from_products
976                     E   	                       return callback()
977                     E   	                   
978                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/bootstrap_jvm_tools.py", line 406, in bootstrap_classpath
979                     E   	                       cache["classpath"] = self._bootstrap_jvm_tool(dep_spec, jvm_tool)
980                     E   	                   
981                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/bootstrap_jvm_tools.py", line 395, in _bootstrap_jvm_tool
982                     E   	                       return self._bootstrap_classpath(jvm_tool, targets)
983                     E   	                   
984                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/bootstrap_jvm_tools.py", line 279, in _bootstrap_classpath
985                     E   	                       self.resolve(executor=None, targets=targets, classpath_products=classpath_holder)
986                     E   	                   
987                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/ivy_task_mixin.py", line 151, in resolve
988                     E   	                       pinned_artifacts=artifact_set,
989                     E   	                   
990                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/ivy_task_mixin.py", line 184, in _resolve_subset
991                     E   	                       pinned_artifacts=pinned_artifacts,
992                     E   	                   
993                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/backend/jvm/tasks/ivy_task_mixin.py", line 246, in _ivy_resolve
994                     E   	                       fingerprint_strategy=fingerprint_strategy,
995                     E   	                   
996                     E   	                     File "/opt/python/3.6.7/lib/python3.6/contextlib.py", line 81, in __enter__
997                     E   	                       return next(self.gen)
998                     E   	                   
999                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/task/task.py", line 440, in invalidated
1000                     E   	                       fingerprint_strategy, invalidate_dependents, targets, topological_order
1001                     E   	                   
1002                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/task/task.py", line 545, in _do_invalidation_check
1003                     E   	                       artifact_write_callback=self.maybe_write_artifact,
1004                     E   	                   
1005                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/invalidation/cache_manager.py", line 306, in __init__
1006                     E   	                       relative_symlink(self._results_dir_prefix, stable_prefix)
1007                     E   	                   
1008                     E   	                     File "/home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/pants/util/dirutil.py", line 514, in relative_symlink
1009                     E   	                       raise ValueError(f"Path for link would overwrite an existing directory: {link_path}")
1010                     E   	                   
1011                     E   	                     Using cached artifacts for 1 target.
1012                     E   	05:52:54 00:06         [ivy-resolve]
1013                     E   	05:52:55 00:07         [cache]
1014                     E   	                     Using cached artifacts for 1 target.
1015                     E   	05:52:55 00:07         [cache]
1016                     E   	                     Using cached artifacts for 1 target.
1017                     E   	05:52:55 00:07         [cache]
1018                     E   	                     Using cached artifacts for 1 target.
1019                     E   	05:52:55 00:07         [ivy-resolve]
1020                     E   	05:52:55 00:07         [cache]
1021                     E   	                     Using cached artifacts for 1 target.
1022                     E   	05:52:56 00:08         [zinc-subsystem]
1023                     E   	                       [info] Non-compiled module 'compiler-interface' for Scala 2.12.8. Compiling...
1024                     E   	                       [info]   Compilation completed in 13.169s.
1025                     E   	                       
1026                     E   	05:53:10 00:22         [mixed]
1027                     E   	                       [info] Compiling 1 Scala source to /home/travis/build/pantsbuild/pants/.pants.d/pyprep/sources/651222c51a175b965bb292286b7c383ac133d628/./.pants.d/tmp/tmpok3sj0aw.pants.d/compile/rsc/c1e3836b60e5/tmp2m0tty7v.cachetestA/current/zinc/classes ...
1028                     E   	                       [info] Done compiling.
1029                     E   	                       [info] Compile success at Mar 16, 2020 5:53:17 AM [6.411s]
1030                     E   	                       
1031                     E   	FAILURE: Compilation failure: ExecutionFailure('Failed jobs: rsc(tmp2m0tty7v:cachetestA)',)
1032                     E   	
1033                     E   	
1034                     E   	               Waiting for background workers to finish.
1035                     E   	05:53:17 00:29   [complete]
1036                     E   	               FAILURE
@jsirois jsirois self-assigned this Mar 24, 2020
jsirois added a commit to jsirois/pants that referenced this issue Mar 25, 2020
This brings our skip count up from 7 python and 2 rust to 25 python and
4 rust, hopefully in the name of stability as outlined in pantsbuild#9386.

Also updates the How to Contribute docs with a pointer to pantsbuild#9386 for
the latest procedure.

Includes flaky tests from:
 pantsbuild#9313 pantsbuild#9312 pantsbuild#8679 pantsbuild#8678 pantsbuild#8520 pantsbuild#8520 pantsbuild#8520 pantsbuild#8405 pantsbuild#8193 pantsbuild#8171 pantsbuild#7836 pantsbuild#7622
 pantsbuild#7573 pantsbuild#7572 pantsbuild#7554 pantsbuild#7547 pantsbuild#7457 pantsbuild#7168 pantsbuild#7149 pantsbuild#6838 pantsbuild#6829 pantsbuild#6787 pantsbuild#6114

[ci skip-jvm-tests]  # No JVM changes made.
jsirois added a commit that referenced this issue Mar 25, 2020
This brings our skip count up from 7 python and 2 rust to 25 python and
4 rust, hopefully in the name of stability as outlined in #9386.

Also updates the How to Contribute docs with a pointer to #9386 for
the latest procedure.

Includes flaky tests from:
 #9313 #9312 #8679 #8678 #8520 #8520 #8520 #8405 #8193 #8171 #7836 #7622
 #7573 #7572 #7554 #7547 #7457 #7168 #7149 #6838 #6829 #6787 #6114
@jsirois jsirois removed their assignment Mar 25, 2020
@Eric-Arellano
Copy link
Contributor Author

Test was deleted in Pants 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants