You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2015/11/11 17:38:31 UTC

[1/2] nifi git commit: NIFI-1061 fixed deadlock caused by DBCPConnectionPool.onConfigured() Current implementation of DBCPConnectionPool was attempting to test if connection could be obtained via dataSource.getConnection(). Such call is naturally a block

Repository: nifi
Updated Branches:
  refs/heads/master 429f6a42b -> 054774fe7


NIFI-1061 fixed deadlock caused by DBCPConnectionPool.onConfigured()
Current implementation of DBCPConnectionPool was attempting to test if connection could be obtained via dataSource.getConnection().
Such call is naturally a blocking call and the duration of the block is dependent on driver implementation. Some drivers (e.g., Phoenix - https://phoenix.apache.org/installation.html)
attempts numerous retries before failing creating a deadlock when attempt was made to disable DBCPConnectionPool which was still being enabled.

This fix removes the connection test from DBCPConnectionPool.onConfigured() operation returning successfully upon creation of DataSource.
For more details see comments in https://issues.apache.org/jira/browse/NIFI-1061


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

Branch: refs/heads/master
Commit: 76690a8ee9ac1907df711525aa2c169168c8c540
Parents: ba5b1d8
Author: Oleg Zhurakousky <ol...@suitcase.io>
Authored: Mon Nov 9 14:47:50 2015 -0500
Committer: Oleg Zhurakousky <ol...@suitcase.io>
Committed: Wed Nov 11 08:33:51 2015 -0500

----------------------------------------------------------------------
 .../scheduling/StandardProcessScheduler.java     |  7 +++++--
 .../org/apache/nifi/dbcp/DBCPConnectionPool.java | 19 +++++++------------
 2 files changed, 12 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/76690a8e/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
index 9ff58c8..ddd4d5c 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
@@ -603,9 +603,12 @@ public final class StandardProcessScheduler implements ProcessScheduler {
     }
 
     /**
-     * Returns the ScheduleState that is registered for the given component; if no ScheduleState current is registered, one is created and registered atomically, and then that value is returned.
+     * Returns the ScheduleState that is registered for the given component; if
+     * no ScheduleState current is registered, one is created and registered
+     * atomically, and then that value is returned.
      *
-     * @param schedulable schedulable
+     * @param schedulable
+     *            schedulable
      * @return scheduled state
      */
     private ScheduleState getScheduleState(final Object schedulable) {

http://git-wip-us.apache.org/repos/asf/nifi/blob/76690a8e/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java b/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java
index 1278af4..08aa966 100644
--- a/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java
+++ b/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java
@@ -132,7 +132,13 @@ public class DBCPConnectionPool extends AbstractControllerService implements DBC
     }
 
     /**
-     * Create new pool, open some connections ready to be used
+     * Configures connection pool by creating an instance of the
+     * {@link BasicDataSource} based on configuration provided with
+     * {@link ConfigurationContext}.
+     *
+     * This operation makes no guarantees that the actual connection could be
+     * made since the underlying system may still go off-line during normal
+     * operation of the connection pool.
      *
      * @param context
      *            the configuration context
@@ -163,17 +169,6 @@ public class DBCPConnectionPool extends AbstractControllerService implements DBC
         dataSource.setUrl(dburl);
         dataSource.setUsername(user);
         dataSource.setPassword(passw);
-
-        // verify connection can be established.
-        try {
-            final Connection con = dataSource.getConnection();
-            if (con == null) {
-                throw new InitializationException("Connection to database cannot be established.");
-            }
-            con.close();
-        } catch (final SQLException e) {
-            throw new InitializationException(e);
-        }
     }
 
     /**


[2/2] nifi git commit: Merge branch 'NIFI-1061' of https://github.com/olegz/nifi into NIFI-1061

Posted by ma...@apache.org.
Merge branch 'NIFI-1061' of https://github.com/olegz/nifi into NIFI-1061


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

Branch: refs/heads/master
Commit: 054774fe7b9fa58abb9afcd6773337059c1652f6
Parents: 429f6a4 76690a8
Author: Mark Payne <ma...@hotmail.com>
Authored: Wed Nov 11 11:17:25 2015 -0500
Committer: Mark Payne <ma...@hotmail.com>
Committed: Wed Nov 11 11:17:25 2015 -0500

----------------------------------------------------------------------
 .../scheduling/StandardProcessScheduler.java     |  7 +++++--
 .../org/apache/nifi/dbcp/DBCPConnectionPool.java | 19 +++++++------------
 2 files changed, 12 insertions(+), 14 deletions(-)
----------------------------------------------------------------------