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

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

I've prepared a test fix for this:
https://github.com/apache/cassandra-dtest/pull/235

In essence, the fix moves the exception throwing to the thread. This is more 
appropriate imho because there is almost no way the exception could be thrown 
before the thread is started.  In only possibility for the production code to 
fail with a leak is that the executor is shutdown and we cannot submit the job. 
In this case, the opened iterator will not be ever closed. However, I suppose 
this could happen only on the server tear down. 

I'm not very happy with the solution. I think we should modify the code so that 
the iterator is opened only in the place where it can be closed - instead of 
passing the ad-hoc initialized key iterator to the builder and assuming that 
{{build}} method will be called, we should rather initialize the iterator 
inside the {{build}} method, where the iterator is closed in the {{finally}} 
block. 


> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to