You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@oozie.apache.org by "Peter Bacsko (JIRA)" <ji...@apache.org> on 2016/06/01 17:22:59 UTC
[jira] [Comment Edited] (OOZIE-2541) Resource leak in
Hive2Credentials
[ https://issues.apache.org/jira/browse/OOZIE-2541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15310692#comment-15310692 ]
Peter Bacsko edited comment on OOZIE-2541 at 6/1/16 5:22 PM:
-------------------------------------------------------------
There is logging, just not visible in the patch.
{code}
@Override
public void addtoJobConf(public void addtoJobConf(JobConf jobconf, CredentialsProperties props, Context context) throws Exception {
try {
// load the driver
Class.forName("org.apache.hive.jdbc.HiveDriver");
String url = props.getProperties().get(HIVE2_JDBC_URL);
if (url == null || url.isEmpty()) {
throw new CredentialException(ErrorCode.E0510,
HIVE2_JDBC_URL + " is required to get hive server 2 credential");
}
String principal = props.getProperties().get(HIVE2_SERVER_PRINCIPAL);
if (principal == null || principal.isEmpty()) {
throw new CredentialException(ErrorCode.E0510,
HIVE2_SERVER_PRINCIPAL + " is required to get hive server 2 credential");
}
...
} finally {
if (con != null) {
con.close();
}
}
}
catch (Exception e) {
XLog.getLog(getClass()).warn("Exception in addtoJobConf", e); <-- logs every exception
throw e;
}
}
{code}
was (Author: pbacsko):
There is logging, just not visible in the patch.
{code}
@Override
public void addtoJobConf(public void addtoJobConf(JobConf jobconf, CredentialsProperties props, Context context) throws Exception {
jobconf.getCredentials().addToken(new Text("hive.server2.delegation.token"), hive2Token);
XLog.getLog(getClass()).debug("Added the Hive Server 2 token in job conf");
...
} finally {
if (con != null) {
con.close();
}
}
}
catch (Exception e) {
XLog.getLog(getClass()).warn("Exception in addtoJobConf", e); <-- logs every exception
throw e;
}
}
{code}
> Resource leak in Hive2Credentials
> ---------------------------------
>
> Key: OOZIE-2541
> URL: https://issues.apache.org/jira/browse/OOZIE-2541
> Project: Oozie
> Issue Type: Bug
> Components: core
> Reporter: Peter Bacsko
> Assignee: Peter Bacsko
> Priority: Trivial
> Attachments: OOZIE-2541-001.patch, OOZIE-2541-002.patch
>
>
> Connection to Hive is not closed in case of an SQLException:
> {code}
> Connection con = DriverManager.getConnection(url);
> XLog.getLog(getClass()).debug("Connected successfully to " + url);
> // get delegation token for the given proxy user
> String tokenStr = ((HiveConnection)con).getDelegationToken(jobconf.get(USER_NAME), principal);
> XLog.getLog(getClass()).debug("Got token");
> {code}
> Close the Connection in a finally block.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)