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

Jason Brown commented on CASSANDRA-13906:
-----------------------------------------

bq. Wouldn't the most idiomatic way to do this be to have 
{{TrackedDataInputPlus}} implement {{Closable}} and use try with resources

I thought about that when I was fixing this, but  {{TrackedDataInputPlus}} 
wraps a {{DataInput}}, which does not declare a {{#close()}} method. In a 
{{TrackedDataInputPlus#close()}} I could check if the wrapped instance 
implements {{Closeable}} and invoke it if it does. wdyt?

There are a couple of other uses of  {{TrackedDataInputPlus}} ({{HintMessage}}, 
{{IndexedEntry}} called on load saved cache path), but they should not be 
affected by {{TrackedDataInputPlus}} implementing {{Closeable}} as the are not 
allocated via try-with-resources. 

Note: if we choose to make this change, which is reasonable, I can also cleanup 
{{CompressedStreamReader}} to also allocate {{TrackedDataInputPlus}} in a 
try-with-resources - it has the same concerns as {{StreamReader}} that you 
raised. Branch coming shortly ...

> Properly close StreamCompressionInputStream to release any ByteBuf
> ------------------------------------------------------------------
>
>                 Key: CASSANDRA-13906
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13906
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Jason Brown
>            Assignee: Jason Brown
>
> When running dtests for trunk (4.x) that perform some streaming, sometimes a 
> {{ByteBuf}} is not released properly, and we get this error in the logs 
> (causing the dtest to fail):
> {code}
> ERROR [MessagingService-NettyOutbound-Thread-4-2] 2017-09-26 13:42:37,940 
> Slf4JLogger.java:176 - LEAK: ByteBuf.release() was not called before it's 
> garbage-collected. Enable advanced leak reporting to find out where the leak 
> occurred. To enable advanced leak reporting, specify the JVM option 
> '-Dio.netty.leakDetection.level=advanced' or call 
> ResourceLeakDetector.setLevel() See 
> http://netty.io/wiki/reference-counted-objects.html for more information.
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to