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

Jacek Lewandowski commented on CASSANDRA-18361:
-----------------------------------------------

In 4.1 {{ReducedKeyIterator}} is initialized lazily, that's why I've initially 
claimed that the flaky test does not affect 4.1. Though there is a problem with 
it:

{code:java}
    Future<?> submitIndexBuild(final SecondaryIndexBuilder builder, 
ActiveCompactionsTracker activeCompactions)
    {
        Runnable runnable = new Runnable()
        {
            public void run()
            {
                activeCompactions.beginCompaction(builder);
                try
                {
                    builder.build();
                }
                finally
                {
                    activeCompactions.finishCompaction(builder);
                }
            }
        };

        return executor.submitIfRunning(runnable, "index build");
    }
{code}

now - the {{builder.build()}} method is supposed to close the key iterator in 
finally block. Since the key iterator internally initialized lazily, it will 
not close if it was not initialized yet; then, 
{{activeCompactions.finishCompaction()}} accesses the key iterator and 
initializes it, and there is no place for it to be closed. In fact, if no 
exception is thrown, {{finishCompaction}} accesses a closed iterator, which imo 
bad anyway.


> Test Failure: 
> secondary_indexes_test.py::TestSecondaryIndexes::test_failing_manual_rebuild_index
> ------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-18361
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18361
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Test/dtest/python
>            Reporter: Andres de la Peña
>            Assignee: Jacek Lewandowski
>            Priority: Normal
>             Fix For: 5.0.x, 5.x
>
>
> The Python dtest 
> {{secondary_indexes_test.py::TestSecondaryIndexes::test_failing_manual_rebuild_index}}
>  is flaky, at least for trunk:
> * 
> https://butler.cassandra.apache.org/#/ci/upstream/workflow/Cassandra-trunk/failure/secondary_indexes_test/TestSecondaryIndexes/test_failing_manual_rebuild_index
> * 
> https://ci-cassandra.apache.org/job/Cassandra-trunk/1501/testReport/dtest.secondary_indexes_test/TestSecondaryIndexes/test_failing_manual_rebuild_index/
> {code}
> Error Message
> failed on teardown with "Unexpected error found in node logs (see stdout for 
> full details). Errors: [[node1] 'ERROR [Reference-Reaper] 2023-03-23 
> 00:23:43,597 Ref.java:237 - LEAK DETECTED: a reference (class 
> org.apache.cassandra.io.util.FileHandle$Cleanup@967019010:/home/cassandra/cassandra/cassandra-dtest/tmp/dtest-hgjoy8rq/test/node1/data0/k/t-b7dae870c91011eda58f05bc40bfcaa1/nc-1-big-Index.db)
>  to class 
> org.apache.cassandra.io.util.FileHandle$Cleanup@967019010:/home/cassandra/cassandra/cassandra-dtest/tmp/dtest-hgjoy8rq/test/node1/data0/k/t-b7dae870c91011eda58f05bc40bfcaa1/nc-1-big-Index.db
>  was not released before the reference was garbage collected']"
> Stacktrace
> Unexpected error found in node logs (see stdout for full details). Errors: 
> [[node1] 'ERROR [Reference-Reaper] 2023-03-23 00:23:43,597 Ref.java:237 - 
> LEAK DETECTED: a reference (class 
> org.apache.cassandra.io.util.FileHandle$Cleanup@967019010:/home/cassandra/cassandra/cassandra-dtest/tmp/dtest-hgjoy8rq/test/node1/data0/k/t-b7dae870c91011eda58f05bc40bfcaa1/nc-1-big-Index.db)
>  to class 
> org.apache.cassandra.io.util.FileHandle$Cleanup@967019010:/home/cassandra/cassandra/cassandra-dtest/tmp/dtest-hgjoy8rq/test/node1/data0/k/t-b7dae870c91011eda58f05bc40bfcaa1/nc-1-big-Index.db
>  was not released before the reference was garbage collected']
> {code}
> The failure can be reproduced in CircleCI:
> * 
> https://app.circleci.com/pipelines/github/adelapena/cassandra/2732/workflows/829434ab-2d1a-4e1c-8c7f-42449fcfda22
> The CircleCI config I used to reproduce the test failure can be generated 
> with:
> {code}
> .circleci/generate.sh -p \
>   -e REPEATED_DTESTS_COUNT=200 \
>   -e 
> REPEATED_DTESTS=secondary_indexes_test.py::TestSecondaryIndexes::test_failing_manual_rebuild_index
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to