You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Alex Liu (JIRA)" <ji...@apache.org> on 2015/12/15 22:32:46 UTC

[jira] [Comment Edited] (CASSANDRA-10837) Cluster/session should be closed in Cassandra Hadoop Input/Output classes

    [ https://issues.apache.org/jira/browse/CASSANDRA-10837?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15058870#comment-15058870 ] 

Alex Liu edited comment on CASSANDRA-10837 at 12/15/15 9:32 PM:
----------------------------------------------------------------

The changes to CqlRecordWriter seems wrong to me.
The Cluster and the Session instances were both properly managed by the try-with-resources statement. In the patch version only the Cluster instance is closed.
================
https://github.com/datastax/java-driver/blob/2.1/driver-core/src/main/java/com/datastax/driver/core/Cluster.java
Cluster doesn't implement AutoClosable interface, so it has to be closed manually. Closing cluster will close all session objects associated with it. 

Making the Cluster an instance variable in NativeRingCache will trigger an error when the write method will be called, as the Cluster has been closed at the end of the constructor.
=================
NativeRingCache uses the cluster to get the metadata in the constructor when cluster object is still open. once the initialization of constructor is done, the cluster object is not used by NativeRingCache anymore.

In CqlInputFormat could you use try-with-resources for both Cluster and Session instances. I think it is best to do things properly by closing both of them.
================
Similarly closing cluster object auto-close all sessions objects.


was (Author: alexliu68):
The changes to CqlRecordWriter seems wrong to me.
The Cluster and the Session instances were both properly managed by the try-with-resources statement. In the patch version only the Cluster instance is closed.
================
https://github.com/datastax/java-driver/blob/2.1/driver-core/src/main/java/com/datastax/driver/core/Cluster.java
Cluster doesn't implements AutoClosable interface, so it has to be closes manually. Closing cluster will close all session objects associated with it. 

Making the Cluster an instance variable in NativeRingCache will trigger an error when the write method will be called, as the Cluster has been closed at the end of the constructor.
=================
NativeRingCache uses the cluster to get the metadata in the constructor when cluster object is still open. once the initialization of constructor is done, the cluster object is not used by NativeRingCache anymore.

In CqlInputFormat could you use try-with-resources for both Cluster and Session instances. I think it is best to do things properly by closing both of them.
================
Similarly closing cluster object auto-close all sessions objects.

> Cluster/session should be closed in Cassandra Hadoop Input/Output classes
> -------------------------------------------------------------------------
>
>                 Key: CASSANDRA-10837
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10837
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>            Reporter: Alex Liu
>            Assignee: Alex Liu
>             Fix For: 3.0.x
>
>         Attachments: 10837-3.0-branch.txt, 10837-v2-3.0-branch.txt
>
>
> See a lot of following warnings during Hadoop job running
> {code}
> ERROR 11:37:45 LEAK: You are creating too many HashedWheelTimer instances.  HashedWheelTimer is a shared resource that must be reused across the JVM,so that only a few instances are created.
> {code}
> Each cluster/session needs be closed and a shared HashedWheelTimer may reduce the resource leakage.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)