You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Johnny Miller (Jira)" <ji...@apache.org> on 2026/09/26 05:24:00 UTC
[jira] [Created] (CASSANDRA-21718) Ref.release can throw IllegalStateException when racing the reference reaper
Johnny Miller created CASSANDRA-21718:
-----------------------------------------
Summary: Ref.release can throw IllegalStateException when racing the reference reaper
Key: CASSANDRA-21718
URL: https://issues.apache.org/jira/browse/CASSANDRA-21718
Project: Apache Cassandra
Issue Type: Bug
Components: Local/Other
Reporter: Johnny Miller
Ref.release() calls state.release(false) without keeping the Ref reachable for the duration of the call (Ref.java line 131 on cassandra-5.0, line 166 on trunk). Ref.State is a PhantomReference to the Ref, so if the caller drops its last strong reference around the same time, the JIT is allowed to treat the Ref as unreachable while release() is still running. The reference reaper can then process the phantom reference concurrently and mark the state released. The caller's release then finds the state already released and throws IllegalStateException("Attempted to release a reference that has already been released") on what was a perfectly correct release.
The DataStax fork fixed this by adding a reachability fence in release, datastax/cassandra@f5af71fa62 (their CNDB-15967). The commit also carries a regression test (GlobalTidyConcurrencyTest) that does not exist in this tree. I could not find an equivalent fix or an existing ticket here.
Verified on cassandra-5.0 and trunk. The code is much older so earlier branches are likely affected too.
Happy to port it the same way as CASSANDRA-21615 if wanted.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org