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

sbt-assembly v1.2.0: Facing java.lang.ArrayIndexOutOfBoundsException: Index 65536 out of bounds for length 132 #475

Open
basant-gurung opened this issue Jul 15, 2022 · 8 comments

Comments

@basant-gurung
Copy link

basant-gurung commented Jul 15, 2022

Facing error when I include "org.apache.cassandra" % "cassandra-all" % "4.0.0" -

[error] java.lang.ArrayIndexOutOfBoundsException: Index 65536 out of bounds for length 132
[error] at org.objectweb.asm.ClassReader.readLabel(ClassReader.java:2679)
[error] at org.objectweb.asm.ClassReader.createLabel(ClassReader.java:2695)
[error] at org.objectweb.asm.ClassReader.readTypeAnnotations(ClassReader.java:2761)
[error] at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1937)
[error] at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1514)
[error] at org.objectweb.asm.ClassReader.accept(ClassReader.java:744)
[error] at org.objectweb.asm.ClassReader.accept(ClassReader.java:424)
[error] at com.eed3si9n.jarjar.ScalaSigProcessor.process(ScalaSigProcessor.scala:15)
[error] at com.eed3si9n.jarjar.util.JarProcessorChain.process(JarProcessorChain.java:38)
[error] at com.eed3si9n.jarjar.JJProcessor.process(JJProcessor.scala:108)
[error] at com.eed3si9n.jarjarabrams.Shader$.$anonfun$bytecodeShader$6(Shader.scala:75)
[error] at com.eed3si9n.jarjarabrams.Shader$.$anonfun$shadeDirectory$4(Shader.scala:21)
[error] at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:293)
[error] at scala.collection.Iterator.foreach(Iterator.scala:943)
[error] at scala.collection.Iterator.foreach$(Iterator.scala:943)
[error] at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
[error] at scala.collection.IterableLike.foreach(IterableLike.scala:74)
[error] at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
[error] at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
[error] at scala.collection.TraversableLike.flatMap(TraversableLike.scala:293)
[error] at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:290)
[error] at scala.collection.AbstractTraversable.flatMap(Traversable.scala:108)
[error] at com.eed3si9n.jarjarabrams.Shader$.shadeDirectory(Shader.scala:17)
[error] at sbtassembly.Assembly$.$anonfun$assembleMappings$11(Assembly.scala:296)
[error] at scala.collection.parallel.AugmentedIterableIterator.map2combiner(RemainsIterator.scala:116)
[error] at scala.collection.parallel.AugmentedIterableIterator.map2combiner$(RemainsIterator.scala:113)
[error] at scala.collection.parallel.immutable.ParVector$ParVectorIterator.map2combiner(ParVector.scala:66)
[error] at scala.collection.parallel.ParIterableLike$Map.leaf(ParIterableLike.scala:1056)
[error] at scala.collection.parallel.Task.$anonfun$tryLeaf$1(Tasks.scala:53)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] at scala.util.control.Breaks$$anon$1.catchBreak(Breaks.scala:67)
[error] at scala.collection.parallel.Task.tryLeaf(Tasks.scala:56)
[error] at scala.collection.parallel.Task.tryLeaf$(Tasks.scala:50)
[error] at scala.collection.parallel.ParIterableLike$Map.tryLeaf(ParIterableLike.scala:1053)
[error] at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.internal(Tasks.scala:170)
[error] at scala.collection.parallel.AdaptiveWorkStealingTasks(Tasks.scala:157)
[error] at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.internal(Tasks.scala:440)
[error] at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute(Tasks.scala:150)
[error] at scala.collection.parallel.AdaptiveWorkStealingTasks(Tasks.scala:149)
[error] at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.compute(Tasks.scala:440)
[error] at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
[error] at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[error] at java.base/java.util.concurrent.ForkJoinPool.awaitJoin(ForkJoinPool.java:1708)
[error] at java.base/java.util.concurrent.ForkJoinTask.doJoin(ForkJoinTask.java:397)
[error] at java.base/java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:721)
[error] at scala.collection.parallel.ForkJoinTasks$WrappedTask.sync(Tasks.scala:379)
[error] at scala.collection.parallel.ForkJoinTasks(Tasks.scala:379)
[error] at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.sync(Tasks.scala:440)
[error] at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.internal(Tasks.scala:174)
[error] at scala.collection.parallel.AdaptiveWorkStealingTasks(Tasks.scala:157)
[error] at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.internal(Tasks.scala:440)
[error] at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute(Tasks.scala:150)
[error] at scala.collection.parallel.AdaptiveWorkStealingTasks(Tasks.scala:149)
[error] at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.compute(Tasks.scala:440)
[error] at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
[error] at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[error] at java.base/java.util.concurrent.ForkJoinTask.doJoin(ForkJoinTask.java:396)
[error] at java.base/java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:721)
[error] at scala.collection.parallel.ForkJoinTasks$WrappedTask.sync(Tasks.scala:379)
[error] at scala.collection.parallel.ForkJoinTasks(Tasks.scala:379)
[error] at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.sync(Tasks.scala:440)
[error] at scala.collection.parallel.ForkJoinTasks.executeAndWaitResult(Tasks.scala:423)
[error] at scala.collection.parallel.ForkJoinTasks.executeAndWaitResult$(Tasks.scala:416)
[error] at scala.collection.parallel.ForkJoinTaskSupport.executeAndWaitResult(TaskSupport.scala:60)
[error] at scala.collection.parallel.ExecutionContextTasks.executeAndWaitResult(Tasks.scala:555)
[error] at scala.collection.parallel.ExecutionContextTasks.executeAndWaitResult$(Tasks.scala:555)
[error] at scala.collection.parallel.ExecutionContextTaskSupport.executeAndWaitResult(TaskSupport.scala:84)
[error] at scala.collection.parallel.ParIterableLike$ResultMapping.leaf(ParIterableLike.scala:960)
[error] at scala.collection.parallel.Task.$anonfun$tryLeaf$1(Tasks.scala:53)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] at scala.util.control.Breaks$$anon$1.catchBreak(Breaks.scala:67)
[error] at scala.collection.parallel.Task.tryLeaf(Tasks.scala:56)
[error] at scala.collection.parallel.Task.tryLeaf$(Tasks.scala:50)
[error] at scala.collection.parallel.ParIterableLike$ResultMapping.tryLeaf(ParIterableLike.scala:955)
[error] at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute(Tasks.scala:153)
[error] at scala.collection.parallel.AdaptiveWorkStealingTasks(Tasks.scala:149)
[error] at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.compute(Tasks.scala:440)
[error] at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
[error] at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[error] at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
[error] at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
[error] at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
[error] at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
@ryan-clancy
Copy link

@basant-gurung Any luck solving the issue? I have run into it as well.

@basant-gurung
Copy link
Author

nope. waiting for them to reply.

@MasseGuillaume
Copy link
Member

MasseGuillaume commented Nov 17, 2023

I'm facing the same issue with a different dependency set. I tried reproducing your issue but it looks like it's fixed:
MasseGuillaume@593ff38

sbt:sbt-assembly> scripted sbt-assembly/large-dep
[info] Wrote /Users/bob/foos/sbt-assembly/target/scala-2.12/sbt-1.0/sbt-assembly_2.12_1.0-2.1.2-SNAPSHOT.pom
[info] Wrote /Users/bob/foos/sbt-assembly/target/scala-2.12/sbt-1.0/sbt-assembly-2.1.2-SNAPSHOT.pom
[info] :: delivering :: com.eed3si9n#sbt-assembly;2.1.2-SNAPSHOT :: 2.1.2-SNAPSHOT :: integration :: Fri Nov 17 15:27:01 EST 2023
[info] 	delivering ivy file to /Users/bob/foos/sbt-assembly/target/scala-2.12/sbt-1.0/ivy-2.1.2-SNAPSHOT.xml
[info] 	published sbt-assembly to /Users/bob/.ivy2/local/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/2.1.2-SNAPSHOT/srcs/sbt-assembly-sources.jar
[info] 	published sbt-assembly_2.12_1.0 to /Users/bob/.ivy2/local/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/2.1.2-SNAPSHOT/jars/sbt-assembly_2.12_1.0.jar
[info] 	published sbt-assembly to /Users/bob/.ivy2/local/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/2.1.2-SNAPSHOT/poms/sbt-assembly.pom
[info] 	published sbt-assembly_2.12_1.0 to /Users/bob/.ivy2/local/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/2.1.2-SNAPSHOT/poms/sbt-assembly_2.12_1.0.pom
[info] 	published sbt-assembly to /Users/bob/.ivy2/local/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/2.1.2-SNAPSHOT/jars/sbt-assembly.jar
[info] 	published sbt-assembly_2.12_1.0 to /Users/bob/.ivy2/local/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/2.1.2-SNAPSHOT/docs/sbt-assembly_2.12_1.0-javadoc.jar
[info] 	published sbt-assembly_2.12_1.0 to /Users/bob/.ivy2/local/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/2.1.2-SNAPSHOT/srcs/sbt-assembly_2.12_1.0-sources.jar
[info] 	published sbt-assembly to /Users/bob/.ivy2/local/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/2.1.2-SNAPSHOT/docs/sbt-assembly-javadoc.jar
[info] 	published ivy to /Users/bob/.ivy2/local/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/2.1.2-SNAPSHOT/ivys/ivy.xml
[info] Running 1 / 1 (100.00%) scripted tests with RunFromSourceMain
[info] Running sbt-assembly/large-dep
[error] [info] [launcher] getting org.scala-sbt sbt 1.9.7  (this may take some time)...
[error] [info] [launcher] getting Scala 2.12.18 (for sbt)...
[info] [info] Updated file /private/var/folders/by/_t348jzs2zz5_pz_7_y6wmnw0000gn/T/sbt_6cfef2df/project/build.properties: set sbt.version to 1.9.7
[info] [info] welcome to sbt 1.9.7 (Amazon.com Inc. Java 17.0.7)
[info] [info] loading settings for project sbt_6cfef2df-build from assembly.sbt ...
[info] [info] loading project definition from /private/var/folders/by/_t348jzs2zz5_pz_7_y6wmnw0000gn/T/sbt_6cfef2df/project
[info] [info] loading settings for project root from build.sbt ...
[info] [info] set current project to root (in build file:/private/var/folders/by/_t348jzs2zz5_pz_7_y6wmnw0000gn/T/sbt_6cfef2df/)
[info] [info] welcome to sbt 1.9.7 (Amazon.com Inc. Java 17.0.7)
[info] [info] loading settings for project sbt_6cfef2df-build from assembly.sbt ...
[info] [info] loading project definition from /private/var/folders/by/_t348jzs2zz5_pz_7_y6wmnw0000gn/T/sbt_6cfef2df/project
[info] [info] loading settings for project root from build.sbt ...
[info] [info] set current project to root (in build file:/private/var/folders/by/_t348jzs2zz5_pz_7_y6wmnw0000gn/T/sbt_6cfef2df/)
[info] [info] compiling 1 Scala source to /private/var/folders/by/_t348jzs2zz5_pz_7_y6wmnw0000gn/T/sbt_6cfef2df/target/scala-2.12/classes ...
[info] [info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.18. Compiling...
[info] [info]   Compilation completed in 4.543s.
[info] [info] done compiling
[info] [info] 23 file(s) merged using strategy 'Rename' (Run the task at debug level to see the details)
[info] [info] 8 file(s) merged using strategy 'Deduplicate' (Run the task at debug level to see the details)
[info] [info] 203 file(s) merged using strategy 'Discard' (Run the task at debug level to see the details)
[info] [info] 6 file(s) merged using strategy 'FilterDistinctLines' (Run the task at debug level to see the details)
[info] [info] Built: /private/var/folders/by/_t348jzs2zz5_pz_7_y6wmnw0000gn/T/sbt_6cfef2df/target/scala-2.12/foo.jar
[info] [info] Jar hash: f808fe97d554097ceaf22d4042189e2e5f95c675
[info] [success] Total time: 11 s, completed Nov. 17, 2023, 3:27:16 p.m.
[info] -rw-r--r--  1 bob  staff    50M 17 Nov 15:27 /private/var/folders/by/_t348jzs2zz5_pz_7_y6wmnw0000gn/T/sbt_6cfef2df/target/scala-2.12/foo.jar
[info]
[info] [success] Total time: 0 s, completed Nov. 17, 2023, 3:27:17 p.m.
[info] + sbt-assembly/large-dep
[success] Total time: 15 s, completed Nov. 17, 2023, 3:27:17 p.m.```

@MasseGuillaume
Copy link
Member

Update: I was just missing a shading rule to trigger the bug:

#511
eed3si9n/jarjar-abrams#45

@MasseGuillaume
Copy link
Member

I'm filling an issue with asm: https://gitlab.ow2.org/asm/asm/-/issues/318008

@matthewthekramer
Copy link

@MasseGuillaume any luck on this? Facing same issue

@MasseGuillaume
Copy link
Member

@matthewthekramer most likely there is an invalid classfile in your claspath. Try to identify what is it and report it to the developer that released that lib.

@max-melentyev
Copy link

Hey, I've faced the same issue. According to discussion in the asm issue this seems to be an issue with jars: compiled bytecode stores annotations incorrectly. Based on this, issue should not happen if dependency would be compiled locally with a compiler that has fix applied (any version after 2019).

Do you know if sbt has support for building dependencies from source rather than using precompiled jar?

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

No branches or pull requests

5 participants