Fork me on GitHub
#tools-deps
<
2020-12-31
>
Spencer Apple21:12:26

Happy NYE everyone! I was curious if anyone has seen the following error when the clojure command is run:

Error building classpath. class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
I’m on clj version: 1.10.1.727 It seems to be intermittent but I’ve only seen it when clj is run with -Sdeps and -Sforce. I’ve seen this error thrown with both the -e and the -m flags used.

seancorfield21:12:27

@splayemu I wonder if you might be hitting a race condition when it is trying to figure out dependencies in parallel for some reason? You can try adding -Sthreads 1 to force it to be single-threaded.

Spencer Apple21:12:46

thank you! It’s been popping up a bunch on our CI lately so I’ll give that a go and report back if it solves the problem.

Spencer Apple21:12:49

Does it force the whole clojure process to only use 1 thread, or does it just change the classpath generation / clojure initialization?

seancorfield21:12:54

Just the part that calculates/downloads dependencies. Once all the dependencies are figured out, the subsequent process that actually runs your code will run as normal.

dominicm21:12:55

Classpath generation

Spencer Apple22:12:14

Great, thanks 🙏

seancorfield22:12:25

I'm a bit surprised folks don't run into this issue more often. I've never seen it happen -- not locally on my Mac, nor on our build/QA server -- but I have seen a handful of people run into it repeatedly.

Spencer Apple22:12:10

hmm yeah I wonder what makes it more likely to happen… I haven’t seen it locally - only on our drone env

Alex Miller (Clojure team)22:12:17

are you using any git deps or s3 maven repo deps?

Spencer Apple22:12:13

yes we have our own maven repo in s3

Spencer Apple22:12:38

and we also use git deps - though not used heavily

Spencer Apple22:12:51

We also use a lot of :local/root deps (not sure if that’s useful info for you)

Alex Miller (Clojure team)22:12:56

yep, although that doesn't help narrow it down much :) s3 repos do dynamic loading of the s3 code so that's a known issue but your stack trace looks like something else. a lot of the maven model building stuff is not thread-safe.

👍 3
ghadi22:12:19

@splayemu is there more stacktrace youre omitting?

Spencer Apple22:12:37

sure, here is one:

Error building classpath. class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
	at java.base/java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1882)
	at java.base/java.util.HashMap$TreeNode.treeify(HashMap.java:1998)
	at java.base/java.util.HashMap.treeifyBin(HashMap.java:767)
	at java.base/java.util.HashMap.putVal(HashMap.java:639)
	at java.base/java.util.HashMap.put(HashMap.java:607)
	at java.base/java.util.HashSet.add(HashSet.java:220)
	at org.apache.maven.model.validation.DefaultModelValidator.validateId(DefaultModelValidator.java:847)
	at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependency(DefaultModelValidator.java:659)
	at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependencies(DefaultModelValidator.java:583)
	at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveModel(DefaultModelValidator.java:368)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:494)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:440)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:430)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:292)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:171)
	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:255)
	at clojure.tools.deps.alpha.extensions.maven$eval816$fn__818.invoke(maven.clj:108)
	at clojure.lang.MultiFn.invoke(MultiFn.java:244)
	at clojure.tools.deps.alpha$expand_deps$children_task__1237$fn__1239$fn__1240.invoke(alpha.clj:250)
	at clojure.tools.deps.alpha.util.concurrent$submit_task$task__500.invoke(concurrent.clj:33)
	at clojure.lang.AFn.call(AFn.java:18)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

Spencer Apple22:12:37

sure, here is one:

Error building classpath. class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
	at java.base/java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1882)
	at java.base/java.util.HashMap$TreeNode.treeify(HashMap.java:1998)
	at java.base/java.util.HashMap.treeifyBin(HashMap.java:767)
	at java.base/java.util.HashMap.putVal(HashMap.java:639)
	at java.base/java.util.HashMap.put(HashMap.java:607)
	at java.base/java.util.HashSet.add(HashSet.java:220)
	at org.apache.maven.model.validation.DefaultModelValidator.validateId(DefaultModelValidator.java:847)
	at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependency(DefaultModelValidator.java:659)
	at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependencies(DefaultModelValidator.java:583)
	at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveModel(DefaultModelValidator.java:368)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:494)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:440)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:430)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:292)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:171)
	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:255)
	at clojure.tools.deps.alpha.extensions.maven$eval816$fn__818.invoke(maven.clj:108)
	at clojure.lang.MultiFn.invoke(MultiFn.java:244)
	at clojure.tools.deps.alpha$expand_deps$children_task__1237$fn__1239$fn__1240.invoke(alpha.clj:250)
	at clojure.tools.deps.alpha.util.concurrent$submit_task$task__500.invoke(concurrent.clj:33)
	at clojure.lang.AFn.call(AFn.java:18)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)