tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbalamo...@apache.org
Subject [2/2] git commit: TEZ-1712. SSL context gets destroyed too soon after downloading data from one of the vertices (Rajesh Balamohan) (Cherry picked from commit e225b5a4ce2bc0fae3f9ed9b6ac213ac8d2166e5)
Date Tue, 28 Oct 2014 07:05:29 GMT
TEZ-1712. SSL context gets destroyed too soon after downloading data from one of the vertices
(Rajesh Balamohan)
(Cherry picked from commit e225b5a4ce2bc0fae3f9ed9b6ac213ac8d2166e5)


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

Branch: refs/heads/branch-0.5
Commit: 4f10ad0b5b9398eba4c8e5b05a4837692a9765be
Parents: 11d35d9
Author: Rajesh Balamohan <rbalamohan@apache.org>
Authored: Tue Oct 28 12:33:59 2014 +0530
Committer: Rajesh Balamohan <rbalamohan@apache.org>
Committed: Tue Oct 28 12:34:23 2014 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../library/common/shuffle/HttpConnection.java  | 43 ++++++++------------
 .../common/shuffle/impl/ShuffleManager.java     |  4 --
 .../common/shuffle/orderedgrouped/Shuffle.java  |  4 --
 4 files changed, 17 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/4f10ad0b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a7e070b..e397b34 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -59,6 +59,7 @@ ALL CHANGES:
   TEZ-1542. Fix a Local Mode crash on concurrentModificationException.
   TEZ-1638. Fix Missing type parametrization in runtime Input/Output configs.
   TEZ-1596. Secure Shuffle utils is extremely expensive for fast queries.
+  TEZ-1712. SSL context gets destroyed too soon after downloading data from one of the vertices.
 
 Release 0.5.1: 2014-10-02
 

http://git-wip-us.apache.org/repos/asf/tez/blob/4f10ad0b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/HttpConnection.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/HttpConnection.java
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/HttpConnection.java
index 5407fe4..6e33993 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/HttpConnection.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/HttpConnection.java
@@ -95,7 +95,7 @@ public class HttpConnection {
 
   private void setupConnection() throws IOException {
     connection = (HttpURLConnection) url.openConnection();
-    if (sslFactory != null) {
+    if (sslFactory != null && httpConnParams.sslShuffle) {
       try {
         ((HttpsURLConnection) connection).setSSLSocketFactory(sslFactory
           .createSSLSocketFactory());
@@ -244,16 +244,6 @@ public class HttpConnection {
   }
 
   /**
-   * Cleanup ssl factory. Should be called after all threads are shutdown.
-   */
-  public synchronized static void cleanupSSLFactory() {
-    if (sslFactory != null) {
-      sslFactory.destroy();
-      sslFactory = null;
-    }
-  }
-
-  /**
    * Cleanup the connection.
    * 
    * @param disconnect
@@ -383,24 +373,23 @@ public class HttpConnection {
 
     public synchronized HttpConnectionParamsBuilder setSSL(boolean sslEnabled,
         Configuration conf) {
-      params.sslShuffle = sslEnabled;
-      if(sslEnabled) {
-        //Create sslFactory if it is null or if it was destroyed earlier
-        if (sslFactory == null || sslFactory.getKeystoresFactory()
-            .getTrustManagers() == null) {
-          LOG.info("Initializing SSL factory in HttpConnection");
-          sslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, conf);
-          try {
-            sslFactory.init();
-          } catch (Exception ex) {
-            sslFactory.destroy();
-            sslFactory = null;
-            throw new RuntimeException(ex);
+      synchronized (HttpConnectionParamsBuilder.class) {
+        params.sslShuffle = sslEnabled;
+        if (sslEnabled) {
+          //Create sslFactory if it is null or if it was destroyed earlier
+          if (sslFactory == null || sslFactory.getKeystoresFactory()
+              .getTrustManagers() == null) {
+            LOG.info("Initializing SSL factory in HttpConnection");
+            sslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, conf);
+            try {
+              sslFactory.init();
+            } catch (Exception ex) {
+              sslFactory.destroy();
+              sslFactory = null;
+              throw new RuntimeException(ex);
+            }
           }
         }
-      } else {
-        //Defensive: In case SSL was initied earlier, clean it up.
-        cleanupSSLFactory();
       }
       return this;
     }

http://git-wip-us.apache.org/repos/asf/tez/blob/4f10ad0b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/impl/ShuffleManager.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/impl/ShuffleManager.java
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/impl/ShuffleManager.java
index 57276b2..75baa39 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/impl/ShuffleManager.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/impl/ShuffleManager.java
@@ -594,10 +594,6 @@ public class ShuffleManager implements FetcherCallback {
         this.fetcherExecutor.shutdownNow(); // Interrupts all running fetchers.
       }
     }
-    //All threads are shutdown.  It is safe to shutdown SSL factory
-    if (httpConnectionParams.isSSLShuffleEnabled()) {
-      HttpConnection.cleanupSSLFactory();
-    }
   }
 
   private void registerCompletedInput(FetchedInput fetchedInput) {

http://git-wip-us.apache.org/repos/asf/tez/blob/4f10ad0b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/Shuffle.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/Shuffle.java
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/Shuffle.java
index 9f59cb2..61e2dfa 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/Shuffle.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/Shuffle.java
@@ -390,10 +390,6 @@ public class Shuffle implements ExceptionReporter {
         }
       }
       fetchers.clear();
-      //All threads are shutdown.  It is safe to shutdown SSL factory
-      if (httpConnectionParams.isSSLShuffleEnabled()) {
-        HttpConnection.cleanupSSLFactory();
-      }
       // throw only the first exception while attempting to shutdown.
       if (ie != null) {
         throw ie;


Mime
View raw message