Repository: spark
Updated Branches:
  refs/heads/branch-1.0 4e9a0cb4a -> c7253daeb


SPARK-1789. Multiple versions of Netty dependencies cause FlumeStreamSuite 
failure

TL;DR is there is a bit of JAR hell trouble with Netty, that can be mostly 
resolved and will resolve a test failure.

I hit the error described at 
http://apache-spark-user-list.1001560.n3.nabble.com/SparkContext-startup-time-out-td1753.html
 while running FlumeStreamingSuite, and have for a short while (is it just me?)

velvia notes:
"I have found a workaround.  If you add akka 2.2.4 to your dependencies, then 
everything works, probably because akka 2.2.4 brings in newer version of Jetty."

There are at least 3 versions of Netty in play in the build:

- the new Flume 1.4.0 dependency brings in io.netty:netty:3.4.0.Final, and that 
is the immediate problem
- the custom version of akka 2.2.3 depends on io.netty:netty:3.6.6.
- but, Spark Core directly uses io.netty:netty-all:4.0.17.Final

The POMs try to exclude other versions of netty, but are excluding 
org.jboss.netty:netty, when in fact older versions of io.netty:netty (not 
netty-all) are also an issue.

The org.jboss.netty:netty excludes are largely unnecessary. I replaced many of 
them with io.netty:netty exclusions until everything agreed on 
io.netty:netty-all:4.0.17.Final.

But this didn't work, since Akka 2.2.3 doesn't work with Netty 4.x. 
Down-grading to 3.6.6.Final across the board made some Spark code not compile.

If the build *keeps* io.netty:netty:3.6.6.Final as well, everything seems to 
work. Part of the reason seems to be that Netty 3.x used the old 
`org.jboss.netty` packages. This is less than ideal, but is no worse than the 
current situation.

So this PR resolves the issue and improves the JAR hell, even if it leaves the 
existing theoretical Netty 3-vs-4 conflict:

- Remove org.jboss.netty excludes where possible, for clarity; they're not 
needed except with Hadoop artifacts
- Add io.netty:netty excludes where needed -- except, let akka keep its 
io.netty:netty
- Change a bit of test code that actually depended on Netty 3.x, to use 4.x 
equivalent
- Update SBT build accordingly

A better change would be to update Akka far enough such that it agrees on Netty 
4.x, but I don't know if that's feasible.

Author: Sean Owen <[email protected]>

Closes #723 from srowen/SPARK-1789 and squashes the following commits:

43661b7 [Sean Owen] Update and add Netty excludes to prevent some JAR conflicts 
that cause test issues
(cherry picked from commit 2b7bd29eb6ee5baf739eec143044ecfc296b9b1f)

Signed-off-by: Patrick Wendell <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/c7253dae
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/c7253dae
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/c7253dae

Branch: refs/heads/branch-1.0
Commit: c7253daeb567f9340528e3578300a1166167cff0
Parents: 4e9a0cb
Author: Sean Owen <[email protected]>
Authored: Sat May 10 20:50:40 2014 -0700
Committer: Patrick Wendell <[email protected]>
Committed: Sat May 10 20:50:52 2014 -0700

----------------------------------------------------------------------
 .../org/apache/spark/LocalSparkContext.scala    |  3 +-
 examples/pom.xml                                |  4 +++
 external/flume/pom.xml                          |  2 +-
 external/mqtt/pom.xml                           |  6 ----
 external/twitter/pom.xml                        |  6 ----
 external/zeromq/pom.xml                         |  6 ----
 pom.xml                                         | 32 ------------------
 project/SparkBuild.scala                        | 35 ++++++++++----------
 8 files changed, 24 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/c7253dae/core/src/test/scala/org/apache/spark/LocalSparkContext.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/org/apache/spark/LocalSparkContext.scala 
b/core/src/test/scala/org/apache/spark/LocalSparkContext.scala
index 4b972f8..53e367a 100644
--- a/core/src/test/scala/org/apache/spark/LocalSparkContext.scala
+++ b/core/src/test/scala/org/apache/spark/LocalSparkContext.scala
@@ -17,8 +17,7 @@
 
 package org.apache.spark
 
-import org.jboss.netty.logging.InternalLoggerFactory
-import org.jboss.netty.logging.Slf4JLoggerFactory
+import _root_.io.netty.util.internal.logging.{Slf4JLoggerFactory, 
InternalLoggerFactory}
 import org.scalatest.BeforeAndAfterAll
 import org.scalatest.BeforeAndAfterEach
 import org.scalatest.Suite

http://git-wip-us.apache.org/repos/asf/spark/blob/c7253dae/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 342d7c0..b7cbb1a 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -107,6 +107,10 @@
           <artifactId>netty</artifactId>
         </exclusion>
         <exclusion>
+          <groupId>io.netty</groupId>
+          <artifactId>netty</artifactId>
+        </exclusion>
+        <exclusion>
           <groupId>commons-logging</groupId>
           <artifactId>commons-logging</artifactId>
         </exclusion>

http://git-wip-us.apache.org/repos/asf/spark/blob/c7253dae/external/flume/pom.xml
----------------------------------------------------------------------
diff --git a/external/flume/pom.xml b/external/flume/pom.xml
index 6ced813..b8fc07f 100644
--- a/external/flume/pom.xml
+++ b/external/flume/pom.xml
@@ -50,7 +50,7 @@
       <version>1.4.0</version>
       <exclusions>
         <exclusion>
-          <groupId>org.jboss.netty</groupId>
+          <groupId>io.netty</groupId>
           <artifactId>netty</artifactId>
         </exclusion>
         <exclusion>

http://git-wip-us.apache.org/repos/asf/spark/blob/c7253dae/external/mqtt/pom.xml
----------------------------------------------------------------------
diff --git a/external/mqtt/pom.xml b/external/mqtt/pom.xml
index c0dc124..f4272ce 100644
--- a/external/mqtt/pom.xml
+++ b/external/mqtt/pom.xml
@@ -53,12 +53,6 @@
       <groupId>${akka.group}</groupId>
       <artifactId>akka-zeromq_${scala.binary.version}</artifactId>
       <version>${akka.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.jboss.netty</groupId>
-          <artifactId>netty</artifactId>
-        </exclusion>
-      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.scalatest</groupId>

http://git-wip-us.apache.org/repos/asf/spark/blob/c7253dae/external/twitter/pom.xml
----------------------------------------------------------------------
diff --git a/external/twitter/pom.xml b/external/twitter/pom.xml
index 73a8d6a..e4c2302 100644
--- a/external/twitter/pom.xml
+++ b/external/twitter/pom.xml
@@ -48,12 +48,6 @@
       <groupId>org.twitter4j</groupId>
       <artifactId>twitter4j-stream</artifactId>
       <version>3.0.3</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.jboss.netty</groupId>
-          <artifactId>netty</artifactId>
-        </exclusion>
-      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.scalatest</groupId>

http://git-wip-us.apache.org/repos/asf/spark/blob/c7253dae/external/zeromq/pom.xml
----------------------------------------------------------------------
diff --git a/external/zeromq/pom.xml b/external/zeromq/pom.xml
index bd7d567..8575c86 100644
--- a/external/zeromq/pom.xml
+++ b/external/zeromq/pom.xml
@@ -48,12 +48,6 @@
       <groupId>${akka.group}</groupId>
       <artifactId>akka-zeromq_${scala.binary.version}</artifactId>
       <version>${akka.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.jboss.netty</groupId>
-          <artifactId>netty</artifactId>
-        </exclusion>
-      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.scalatest</groupId>

http://git-wip-us.apache.org/repos/asf/spark/blob/c7253dae/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 17817a9..d369ae8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -324,45 +324,21 @@
         <groupId>${akka.group}</groupId>
         <artifactId>akka-actor_${scala.binary.version}</artifactId>
         <version>${akka.version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>org.jboss.netty</groupId>
-            <artifactId>netty</artifactId>
-          </exclusion>
-        </exclusions>
       </dependency>
       <dependency>
         <groupId>${akka.group}</groupId>
         <artifactId>akka-remote_${scala.binary.version}</artifactId>
         <version>${akka.version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>org.jboss.netty</groupId>
-            <artifactId>netty</artifactId>
-          </exclusion>
-        </exclusions>
       </dependency>
       <dependency>
         <groupId>${akka.group}</groupId>
         <artifactId>akka-slf4j_${scala.binary.version}</artifactId>
         <version>${akka.version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>org.jboss.netty</groupId>
-            <artifactId>netty</artifactId>
-          </exclusion>
-        </exclusions>
       </dependency>
       <dependency>
         <groupId>${akka.group}</groupId>
         <artifactId>akka-testkit_${scala.binary.version}</artifactId>
         <version>${akka.version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>org.jboss.netty</groupId>
-            <artifactId>netty</artifactId>
-          </exclusion>
-        </exclusions>
       </dependency>
       <dependency>
         <groupId>colt</groupId>
@@ -514,10 +490,6 @@
         <version>${avro.version}</version>
         <exclusions>
           <exclusion>
-            <groupId>org.jboss.netty</groupId>
-            <artifactId>netty</artifactId>
-          </exclusion>
-          <exclusion>
             <groupId>io.netty</groupId>
             <artifactId>netty</artifactId>
           </exclusion>
@@ -552,10 +524,6 @@
         <version>${avro.version}</version>
         <exclusions>
           <exclusion>
-            <groupId>org.jboss.netty</groupId>
-            <artifactId>netty</artifactId>
-          </exclusion>
-          <exclusion>
             <groupId>io.netty</groupId>
             <artifactId>netty</artifactId>
           </exclusion>

http://git-wip-us.apache.org/repos/asf/spark/blob/c7253dae/project/SparkBuild.scala
----------------------------------------------------------------------
diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala
index eba9e97..6ea30d0 100644
--- a/project/SparkBuild.scala
+++ b/project/SparkBuild.scala
@@ -303,7 +303,8 @@ object SparkBuild extends Build {
   val parquetVersion = "1.4.3"
   val slf4jVersion = "1.7.5"
 
-  val excludeNetty = ExclusionRule(organization = "org.jboss.netty")
+  val excludeJBossNetty = ExclusionRule(organization = "org.jboss.netty")
+  val excludeIONetty = ExclusionRule(organization = "io.netty")
   val excludeEclipseJetty = ExclusionRule(organization = "org.eclipse.jetty")
   val excludeAsm = ExclusionRule(organization = "org.ow2.asm")
   val excludeOldAsm = ExclusionRule(organization = "asm")
@@ -337,8 +338,8 @@ object SparkBuild extends Build {
         "commons-daemon"             % "commons-daemon"   % "1.0.10", // 
workaround for bug HADOOP-9407
         "com.ning"                   % "compress-lzf"     % "1.0.0",
         "org.xerial.snappy"          % "snappy-java"      % "1.0.5",
-        "org.spark-project.akka"    %% "akka-remote"      % akkaVersion 
excludeAll(excludeNetty),
-        "org.spark-project.akka"    %% "akka-slf4j"       % akkaVersion 
excludeAll(excludeNetty),
+        "org.spark-project.akka"    %% "akka-remote"      % akkaVersion,
+        "org.spark-project.akka"    %% "akka-slf4j"       % akkaVersion,
         "org.spark-project.akka"    %% "akka-testkit"     % akkaVersion % 
"test",
         "org.json4s"                %% "json4s-jackson"   % "3.2.6" 
excludeAll(excludeScalap),
         "colt"                       % "colt"             % "1.2.0",
@@ -346,8 +347,8 @@ object SparkBuild extends Build {
         "commons-net"                % "commons-net"      % "2.2",
         "net.java.dev.jets3t"        % "jets3t"           % jets3tVersion 
excludeAll(excludeCommonsLogging),
         "org.apache.derby"           % "derby"            % "10.4.2.0"         
            % "test",
-        "org.apache.hadoop"          % hadoopClient       % hadoopVersion 
excludeAll(excludeNetty, excludeAsm, excludeCommonsLogging, excludeSLF4J, 
excludeOldAsm),
-        "org.apache.curator"         % "curator-recipes"  % "2.4.0" 
excludeAll(excludeNetty),
+        "org.apache.hadoop"          % hadoopClient       % hadoopVersion 
excludeAll(excludeJBossNetty, excludeAsm, excludeCommonsLogging, excludeSLF4J, 
excludeOldAsm),
+        "org.apache.curator"         % "curator-recipes"  % "2.4.0" 
excludeAll(excludeJBossNetty),
         "com.codahale.metrics"       % "metrics-core"     % 
codahaleMetricsVersion,
         "com.codahale.metrics"       % "metrics-jvm"      % 
codahaleMetricsVersion,
         "com.codahale.metrics"       % "metrics-json"     % 
codahaleMetricsVersion,
@@ -421,7 +422,7 @@ object SparkBuild extends Build {
       v => "spark-examples-" + v + "-hadoop" + hadoopVersion + ".jar" },
     libraryDependencies ++= Seq(
       "com.twitter"          %% "algebird-core"   % "0.1.11",
-      "org.apache.hbase" % "hbase" % HBASE_VERSION excludeAll(excludeNetty, 
excludeAsm, excludeOldAsm, excludeCommonsLogging, excludeJruby),
+      "org.apache.hbase" % "hbase" % HBASE_VERSION excludeAll(excludeIONetty, 
excludeJBossNetty, excludeAsm, excludeOldAsm, excludeCommonsLogging, 
excludeJruby),
       "org.apache.cassandra" % "cassandra-all" % "1.2.6"
         exclude("com.google.guava", "guava")
         exclude("com.googlecode.concurrentlinkedhashmap", 
"concurrentlinkedhashmap-lru")
@@ -429,7 +430,7 @@ object SparkBuild extends Build {
         exclude("io.netty", "netty")
         exclude("jline","jline")
         exclude("org.apache.cassandra.deps", "avro")
-        excludeAll(excludeSLF4J),
+        excludeAll(excludeSLF4J, excludeIONetty),
       "com.github.scopt" %% "scopt" % "3.2.0"
     )
   ) ++ assemblySettings ++ extraAssemblySettings
@@ -561,11 +562,11 @@ object SparkBuild extends Build {
   def yarnEnabledSettings = Seq(
     libraryDependencies ++= Seq(
       // Exclude rule required for all ?
-      "org.apache.hadoop" % hadoopClient         % hadoopVersion 
excludeAll(excludeNetty, excludeAsm, excludeOldAsm),
-      "org.apache.hadoop" % "hadoop-yarn-api"    % hadoopVersion 
excludeAll(excludeNetty, excludeAsm, excludeOldAsm),
-      "org.apache.hadoop" % "hadoop-yarn-common" % hadoopVersion 
excludeAll(excludeNetty, excludeAsm, excludeOldAsm),
-      "org.apache.hadoop" % "hadoop-yarn-client" % hadoopVersion 
excludeAll(excludeNetty, excludeAsm, excludeOldAsm),
-      "org.apache.hadoop" % "hadoop-yarn-server-web-proxy" % hadoopVersion 
excludeAll(excludeNetty, excludeAsm, excludeOldAsm)
+      "org.apache.hadoop" % hadoopClient         % hadoopVersion 
excludeAll(excludeJBossNetty, excludeAsm, excludeOldAsm),
+      "org.apache.hadoop" % "hadoop-yarn-api"    % hadoopVersion 
excludeAll(excludeJBossNetty, excludeAsm, excludeOldAsm),
+      "org.apache.hadoop" % "hadoop-yarn-common" % hadoopVersion 
excludeAll(excludeJBossNetty, excludeAsm, excludeOldAsm),
+      "org.apache.hadoop" % "hadoop-yarn-client" % hadoopVersion 
excludeAll(excludeJBossNetty, excludeAsm, excludeOldAsm),
+      "org.apache.hadoop" % "hadoop-yarn-server-web-proxy" % hadoopVersion 
excludeAll(excludeJBossNetty, excludeAsm, excludeOldAsm)
     )
   )
 
@@ -593,7 +594,7 @@ object SparkBuild extends Build {
     name := "spark-streaming-twitter",
     previousArtifact := sparkPreviousArtifact("spark-streaming-twitter"),
     libraryDependencies ++= Seq(
-      "org.twitter4j" % "twitter4j-stream" % "3.0.3" excludeAll(excludeNetty)
+      "org.twitter4j" % "twitter4j-stream" % "3.0.3"
     )
   )
 
@@ -601,12 +602,12 @@ object SparkBuild extends Build {
     name := "spark-streaming-kafka",
     previousArtifact := sparkPreviousArtifact("spark-streaming-kafka"),
     libraryDependencies ++= Seq(
-      "com.github.sgroschupf"    % "zkclient"   % "0.1"          
excludeAll(excludeNetty),
+      "com.github.sgroschupf"    % "zkclient"   % "0.1",
       "org.apache.kafka"        %% "kafka"      % "0.8.0"
         exclude("com.sun.jdmk", "jmxtools")
         exclude("com.sun.jmx", "jmxri")
         exclude("net.sf.jopt-simple", "jopt-simple")
-        excludeAll(excludeNetty, excludeSLF4J)
+        excludeAll(excludeSLF4J)
     )
   )
 
@@ -614,7 +615,7 @@ object SparkBuild extends Build {
     name := "spark-streaming-flume",
     previousArtifact := sparkPreviousArtifact("spark-streaming-flume"),
     libraryDependencies ++= Seq(
-      "org.apache.flume" % "flume-ng-sdk" % "1.4.0" % "compile" 
excludeAll(excludeNetty, excludeThrift)
+      "org.apache.flume" % "flume-ng-sdk" % "1.4.0" % "compile" 
excludeAll(excludeIONetty, excludeThrift)
     )
   )
 
@@ -622,7 +623,7 @@ object SparkBuild extends Build {
     name := "spark-streaming-zeromq",
     previousArtifact := sparkPreviousArtifact("spark-streaming-zeromq"),
     libraryDependencies ++= Seq(
-      "org.spark-project.akka" %% "akka-zeromq" % akkaVersion 
excludeAll(excludeNetty)
+      "org.spark-project.akka" %% "akka-zeromq" % akkaVersion
     )
   )
 

Reply via email to