zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject zeppelin git commit: [ZEPPELIN-2900] Close connection on getUserList
Date Wed, 06 Sep 2017 15:36:05 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/master 629e21769 -> b14f5ab95


[ZEPPELIN-2900] Close connection on getUserList

### What is this PR for?
This PR fixed a JDBC connection leak on `GetUserList.getUserList` when the Shiro Realm is
a JdbcRealm. After a while, it's not possible to even login into zeppelin.

### What type of PR is it?
Bug Fix

### Todos
N/A

### What is the Jira issue?
[ZEPPELIN-2900](https://issues.apache.org/jira/browse/ZEPPELIN-2900)

### How should this be tested?
In order to reproduce the bug follow this steps:

1. Configure zeppelin to use a JdbcRealm for authentication with a low number of connections
in the connection pool.
2. Login into zeppelin and open a notebook.
3. Open the permissions form of the notebook.
4. Try to add several users to the owners list (more than the number of connections of the
connection pool.

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? No.
* Is there breaking changes for older versions? No that I'm aware.
* Does this needs documentation? No.

Author: Luis Vicente <langel.vicente@gmail.com>

Closes #2567 from lvicentesanchez/bugfix/zeppelin-2900 and squashes the following commits:

ad5bb9b [Luis Vicente] [ZEPPELIN-2900] Close connection on getUserList


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

Branch: refs/heads/master
Commit: b14f5ab956caef4793dcb503d199f206984b2556
Parents: 629e217
Author: Luis Vicente <langel.vicente@gmail.com>
Authored: Tue Sep 5 15:30:10 2017 +0100
Committer: Lee moon soo <moon@apache.org>
Committed: Wed Sep 6 08:36:01 2017 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/zeppelin/rest/GetUserList.java      | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b14f5ab9/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
index 458d5bd..67d6328 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
@@ -202,6 +202,7 @@ public class GetUserList {
    */
   public List<String> getUserList(JdbcRealm obj) {
     List<String> userlist = new ArrayList<>();
+    Connection con = null;
     PreparedStatement ps = null;
     ResultSet rs = null;
     DataSource dataSource = null;
@@ -239,7 +240,7 @@ public class GetUserList {
     }
 
     try {
-      Connection con = dataSource.getConnection();
+      con = dataSource.getConnection();
       ps = con.prepareStatement(userquery);
       ps.setString(1, username);
       ps.setString(2, tablename);
@@ -252,6 +253,7 @@ public class GetUserList {
     } finally {
       JdbcUtils.closeResultSet(rs);
       JdbcUtils.closeStatement(ps);
+      JdbcUtils.closeConnection(con);
     }
     return userlist;
   }


Mime
View raw message