sbt / sbt-assembly

Deploy über-JARs. Restart processes. (port of codahale/assembly-sbt)
MIT License
1.95k stars 224 forks source link

Can not get 3 repeatable successful assembly runs with same build file, and very odd error #136

Closed helena closed 9 years ago

helena commented 9 years ago

In trying to reproduce and fix this bug https://github.com/datastax/spark-cassandra-connector/issues/459 I created this repo with this build https://github.com/helena/fu/blob/master/project/FuBuild.scala and found that I get either of these each time:

I can't get 3 repeatable successes with the same build file, no changes.

sbt 0.13.7 scala 2.10.4 jdk 1.7.0_71 mac 10.9.5

The failures are like this

$ sbt assembly
[info] Loading global plugins from /Users/helena/.sbt/0.13/plugins
[info] Loading project definition from /Users/helena/development/fu/project
[info] Set current project to fu (in build file:/Users/helena/development/fu/)
[info] Including from cache: metrics-graphite-3.0.0.jar
[info] Including from cache: metrics-jvm-3.0.0.jar
[info] Including from cache: joda-convert-1.2.jar
[info] Including: oro-2.0.8.jar
[info] Including from cache: objenesis-1.2.jar
[info] Including from cache: commons-io-2.4.jar
[info] Including from cache: metrics-core-3.0.2.jar
[info] Including from cache: jackson-core-2.3.1.jar
[info] Including from cache: jetty-xml-8.1.14.v20131031.jar
[info] Including from cache: config-1.0.2.jar
[info] Including from cache: jetty-server-8.1.14.v20131031.jar
[info] Including from cache: hsqldb-1.8.0.10.jar
[info] Including from cache: jul-to-slf4j-1.7.5.jar
[info] Including from cache: joda-time-2.3.jar
[info] Including from cache: cassandra-clientutil-2.1.2.jar
[info] Including from cache: commons-el-1.0.jar
[info] Including from cache: lz4-1.2.0.jar
[info] Including from cache: spark-cassandra-connector_2.10-1.1.0.jar
[info] Including: concurrent-1.3.4.jar
[info] Including from cache: jackson-mapper-asl-1.8.8.jar
[info] Including: scalap-2.10.4.jar
[info] Including from cache: jets3t-0.7.1.jar
[info] Including: commons-lang3-3.3.2.jar
[info] Including: netty-3.9.0.Final.jar
[info] Including: cassandra-driver-core-2.1.3.jar
[info] Including from cache: spark-core_2.10-1.1.0.jar
[info] Including: jcl-over-slf4j-1.7.5.jar
[info] Including from cache: scala-library.jar
[info] Including: httpclient-4.2.5.jar
[info] Including from cache: scala-compiler.jar
[info] Including: akka-remote_2.10-2.2.3-shaded-protobuf.jar
[info] Including: cassandra-driver-core-2.1.3.jar
[info] Including: commons-codec-1.5.jar
[info] Including from cache: curator-recipes-2.4.0.jar
[info] Including: scala-reflect.jar
[info] Including: commons-collections-3.2.1.jar
[info] Including: jetty-io-8.1.14.v20131031.jar
[info] Including: jetty-security-8.1.14.v20131031.jar
[info] Including: uncommons-maths-1.2.2a.jar
[info] Including: javax.transaction-1.1.1.v201105210645.jar
[info] Including: jackson-annotations-2.3.0.jar
[info] Including: paranamer-2.6.jar
[info] Including: tachyon-0.5.0.jar
[info] Including: jackson-databind-2.3.1.jar
[info] Including: snappy-java-1.0.5.3.jar
[info] Including: hadoop-core-1.0.4.jar
[info] Including: commons-net-2.2.jar
[info] Including: netty-all-4.0.23.Final.jar
[info] Including: mesos-0.18.1-shaded-protobuf.jar
[info] Including: curator-client-2.4.0.jar
[info] Including: javax.activation-1.1.0.v201105071233.jar
[info] Including: jsr305-1.3.9.jar
[info] Including: libthrift-0.9.1.jar
[info] Including: log4j-1.2.17.jar
[info] Including: metrics-json-3.0.0.jar
[info] Including: pyrolite-2.0.1.jar
scala.collection.parallel.CompositeThrowable: Multiple exceptions thrown during a parallel computation: java.io.FileNotFoundException: /Users/helena/.ivy2/cache/com.esotericsoftware.reflectasm/reflectasm/jars/reflectasm-1.07-shaded.jar (Interrupted system call)
java.io.FileInputStream.open(Native Method)
java.io.FileInputStream.<init>(FileInputStream.java:146)
sbt.Using$$anonfun$fileInputStream$1.apply(Using.scala:73)
sbt.Using$$anonfun$fileInputStream$1.apply(Using.scala:73)
sbt.Using$$anon$2.openImpl(Using.scala:65)
sbt.OpenFile$class.open(Using.scala:43)
sbt.Using$$anon$2.open(Using.scala:64)
sbt.Using$$anon$2.open(Using.scala:64)
sbt.Using.apply(Using.scala:23)
sbt.IO$.readBytes(IO.scala:648)
.
.
.

java.io.FileNotFoundException: /Users/helena/.ivy2/cache/com.google.guava/guava/bundles/guava-16.0.jar (Interrupted system call)
java.io.FileInputStream.open(Native Method)
java.io.FileInputStream.<init>(FileInputStream.java:146)
sbt.Using$$anonfun$fileInputStream$1.apply(Using.scala:73)
sbt.Using$$anonfun$fileInputStream$1.apply(Using.scala:73)
sbt.Using$$anon$2.openImpl(Using.scala:65)
sbt.OpenFile$class.open(Using.scala:43)
sbt.Using$$anon$2.open(Using.scala:64)
sbt.Using$$anon$2.open(Using.scala:64)
sbt.Using.apply(Using.scala:23)
sbt.IO$.readBytes(IO.scala:648)
.
.
.

java.io.FileNotFoundException: /Users/helena/.ivy2/cache/org.apache.commons/commons-math/jars/commons-math-2.1.jar (Interrupted system call)
java.io.FileInputStream.open(Native Method)
java.io.FileInputStream.<init>(FileInputStream.java:146)
sbt.Using$$anonfun$fileInputStream$1.apply(Using.scala:73)
sbt.Using$$anonfun$fileInputStream$1.apply(Using.scala:73)
sbt.Using$$anon$2.openImpl(Using.scala:65)
sbt.OpenFile$class.open(Using.scala:43)
sbt.Using$$anon$2.open(Using.scala:64)
sbt.Using$$anon$2.open(Using.scala:64)
sbt.Using.apply(Using.scala:23)
sbt.IO$.readBytes(IO.scala:648)
.
.
.

java.io.FileNotFoundException: /Users/helena/.ivy2/cache/com.esotericsoftware.kryo/kryo/bundles/kryo-2.21.jar (Interrupted system call)
java.io.FileInputStream.open(Native Method)
java.io.FileInputStream.<init>(FileInputStream.java:146)
sbt.Using$$anonfun$fileInputStream$1.apply(Using.scala:73)
sbt.Using$$anonfun$fileInputStream$1.apply(Using.scala:73)
sbt.Using$$anon$2.openImpl(Using.scala:65)
sbt.OpenFile$class.open(Using.scala:43)
sbt.Using$$anon$2.open(Using.scala:64)
sbt.Using$$anon$2.open(Using.scala:64)

... many many more lines of the same pattern, different jars

eed3si9n commented 9 years ago

I grabbed your build locally on my Mac, but could not reproduce the issue. I got "[info] Including from cache: ..." for all jars. The log you show seems to show mixed hit on cache, which is weird if you're just running assembly three times in a row.

helena commented 9 years ago

Hrm, I'll see if anyone else gets your outcome vs mine. Thanks.

eed3si9n commented 9 years ago

Any updates? I cannot reproduce the issue with either running

$ sbt "; clean; assembly; clean; assembly; clean; assembly"

or

$ sbt "; assembly; assembly; assembly"
helena commented 9 years ago

Hi @eed3si9n thanks for checking back. The issue is resolved, it was related to some configuration in the assembly I had.

eed3si9n commented 9 years ago

I'm closing this then.

kushal-mangtani commented 9 years ago

Hello @helena - could you mention how you resolved this error ? I am getting the same exception trace.However, my build is not successfull even after running clean and assembly. Also, i believe there is something funky with my build.sbt. Pasted below

import AssemblyKeys._

name := "spark_streaming"

version := "1.0"

scalaVersion := "2.10.3"

ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }

parallelExecution := false

parallelExecution in Test := false

libraryDependencies ++= Seq(
    "org.apache.spark" % "spark-core_2.10" % "1.2.0",
    "org.apache.spark" % "spark-streaming_2.10" % "1.2.0",
    "org.apache.spark" % "spark-streaming-kafka_2.10" % "1.2.0",
    "org.apache.hadoop" % "hadoop-client" % "2.6.0",
    "org.apache.kafka" % "kafka_2.10" % "0.8.2.0",
    "joda-time" % "joda-time" % "2.7",
    "net.java.dev.jna" % "jna" % "4.1.0",
    "net.java.dev.jna" % "jna-platform" % "4.1.0")

resolvers += "Maven repo" at "https://oss.sonatype.org/content/repositories/snapshots"    

unmanagedJars in Compile += file("/custom-SNAPSHOT.jar")

Revolver.settings

assemblySettings

// ignoring running tests in assembly phase..
test in assembly := {}
helena commented 9 years ago

Hrm, it was something possibly related to another process running that modified the output dir, I don't recall, or something minor in the build.

kushalmangtani commented 9 years ago

For posterity, this error was resolved. It required a bunch of tweaks in my build.sbt file.

Things to look out , when u encountered this error.

  1. make sure there is no sbt process running concurrently. Hint: ps -ef | grep sbt
  2. provided configuration in sbt-assembly https://github.com/sbt/sbt-assembly#-provided-configuration

Also, as a suggestion for debugging purposes, you should create a new sbt project and add all the libraryDependencies one-by-one in build.sbt && try to build a assembly jar.This will help u in debugging the library dependency which causes the error

Here is my updated build.sbt. My project needs spark-streaming and spray framework as dependencies

import AssemblyKeys._

name := "test-sbt"

version := "1.0"

scalaVersion := "2.11.5"

resolvers ++= Seq(
  "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
  "jgit-repository" at "http://download.eclipse.org/jgit/maven",
  "releases" at "http://oss.sonatype.org/content/repositories/releases",
  "maven" at "https://repo1.maven.org/maven2/",
  "spray repo" at "http://repo.spray.io"
)

libraryDependencies ++= {
  val sprayVersion = "1.3.3"
  val akkaVersion = "2.3.9"
  val sprayJsonVersion = "1.3.1"
  val scalaTestVersion = "2.2.1"

  Seq(
    // excluding transitive deps. creating fat-jar with spark is painful. https://github.com/sbt/sbt-assembly#exclude-specific-transitive-deps
    "org.apache.spark" %% "spark-core" % "1.3.0"
      exclude("com.twitter", "parquet-format")
      exclude("org.mortbay.jetty", "servlet-api")
      exclude("commons-beanutils", "commons-beanutils-core")
      exclude("commons-collections", "commons-collections")
      exclude("commons-logging", "commons-logging")
      exclude("com.esotericsoftware.minlog", "minlog")
      exclude("org.apache.spark", "spark-network-common_2.11")
      exclude("org.apache.spark", "spark-network-shuffle_2.11")
      exclude("org.apache.hadoop", "hadoop-yarn-common")
      exclude("org.spark-project.spark", "unused"),
    "org.apache.spark" %% "spark-streaming" % "1.3.0"
      exclude("org.spark-project.spark", "unused")
      exclude("org.apache.spark", "spark-core"),
    //  JNA dependencies
    "net.java.dev.jna" % "jna" % "4.1.0",
    "net.java.dev.jna" % "jna-platform" % "4.1.0",
    // Spray client libs
    // spark-core already includes a akka-actor.jar, so including it resolves in a deduplicate exception. Hence, using 'provided' task
    // https://github.com/sbt/sbt-assembly#-provided-configuration
    "com.typesafe.akka" %% "akka-actor" % akkaVersion % "provided",
    "io.spray" %% "spray-client" % sprayVersion,
    "io.spray" %% "spray-json" % sprayJsonVersion,
    // Scala test libs
    "org.scalatest" %% "scalatest" % scalaTestVersion % "test"
  )
}
ivyScala := ivyScala.value map {
  _.copy(overrideScalaVersion = true)
}
Revolver.settings

Revolver.reColors := Seq("blue", "green", "magenta")

unmanagedJars in Compile += file("custom.jar")

assemblySettings
helena commented 9 years ago

@eed3si9n this is caused by missing particular dependencies that may be excluded directly or indirectly in a build file. Just fix this and it is resolved.

SylviaVargasCTL commented 9 years ago

For future reference, it's easier to pull the jar file from the following:

http://mvnrepository.com/artifact/com.datastax.spark/spark-cassandra-connector_2.10/1.4.0

kevinmeredith commented 8 years ago

this is caused by missing particular dependencies that may be excluded directly or indirectly in a build file. Just fix this and it is resolved.

@helena - could you please provide more details? If you had a missing dependency, then wouldn't you just get an error when trying to resolve a class, i.e. but no such dependency contained it?

Example: new com.mycompany.Foobar, but no such dependency (in build.sbt) provides that class?

Thanks