[ 
https://issues.apache.org/jira/browse/CASSANDRA-16119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Caleb Rackliffe updated CASSANDRA-16119:
----------------------------------------
    Test and Documentation Plan: passing unit tests (as this is a change 
specifically to a unit test helper)
                         Status: Patch Available  (was: In Progress)

[patch|https://github.com/apache/cassandra/pull/744], [j8 
tests|https://app.circleci.com/pipelines/github/maedhroz/cassandra/108/workflows/5ce25733-c058-48b9-add4-1fa07f95a59a],
 [j11 
tests|https://app.circleci.com/pipelines/github/maedhroz/cassandra/108/workflows/83a675f2-d3c2-4ad6-82e4-b56ae992ab6e]

> MockSchema's SSTableReader creation leaks FileHandle and Channel instances
> --------------------------------------------------------------------------
>
>                 Key: CASSANDRA-16119
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16119
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Test/unit
>            Reporter: Caleb Rackliffe
>            Assignee: Caleb Rackliffe
>            Priority: Normal
>             Fix For: 4.0-beta
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{MockSchema}} creates {{SSTableReader}} instances for testing, but when it 
> does, it doesn’t seem to ever close the {{FileHandle}} and {{Channel}} 
> instances from which copies are made for the actual readers. ({{FileHandle}} 
> itself also internally copies the channel on creation.) This can trigger leak 
> detection, although perhaps not reliably, from tests like 
> {{AntiCompactionTest}}. A couple well-placed {{try-with-resources}} blocks 
> should help us avoid this (and shouldn't risk closing anything too early, 
> since the close methods for handles and channels seem only to do reference 
> bookkeeping anyway).
> Example:
> {noformat}
> [junit-timeout] ERROR 16:35:47,747 LEAK DETECTED: a reference 
> (org.apache.cassandra.utils.concurrent.Ref$State@487c0fdb) to class 
> org.apache.cassandra.io.util.FileHandle$Cleanup@2072030898:/var/folders/4d/zfjs7m7s6x5_l93k33r5k6680000gn/T/mocksegmentedfile0tmp
>  was not released before the reference was garbage collected
> [junit-timeout] ERROR 16:35:47,747 Allocate trace 
> org.apache.cassandra.utils.concurrent.Ref$State@487c0fdb:
> [junit-timeout] Thread[main,5,main]
> [junit-timeout]       at java.lang.Thread.getStackTrace(Thread.java:1559)
> [junit-timeout]       at 
> org.apache.cassandra.utils.concurrent.Ref$Debug.<init>(Ref.java:249)
> [junit-timeout]       at 
> org.apache.cassandra.utils.concurrent.Ref$State.<init>(Ref.java:179)
> [junit-timeout]       at 
> org.apache.cassandra.utils.concurrent.Ref.<init>(Ref.java:101)
> [junit-timeout]       at 
> org.apache.cassandra.utils.concurrent.SharedCloseableImpl.<init>(SharedCloseableImpl.java:30)
> [junit-timeout]       at 
> org.apache.cassandra.io.util.FileHandle.<init>(FileHandle.java:74)
> [junit-timeout]       at 
> org.apache.cassandra.io.util.FileHandle.<init>(FileHandle.java:50)
> [junit-timeout]       at 
> org.apache.cassandra.io.util.FileHandle$Builder.complete(FileHandle.java:389)
> [junit-timeout]       at 
> org.apache.cassandra.schema.MockSchema.sstable(MockSchema.java:124)
> [junit-timeout]       at 
> org.apache.cassandra.schema.MockSchema.sstable(MockSchema.java:83)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to