Details
-
Improvement
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
None
Description
We've had a spate of bugs recently with bad reference counting. these can have potentially dire consequences, generally either randomly deleting data or giving us infinite loops.
Since in 2.1 we only reference count resources that are relatively expensive and infrequently managed (or in places where this safety is probably not as necessary, e.g. SerializingCache), we could without any negative consequences (and only slight code complexity) introduce a safer resource management scheme for these more expensive/infrequent actions.
Basically, I propose when we want to acquire a resource we allocate an object that manages the reference. This can only be released once; if it is released twice, we fail immediately at the second release, reporting where the bug is (rather than letting it continue fine until the next correct release corrupts the count). The reference counter remains the same, but we obtain guarantees that the reference count itself is never badly maintained, although code using it could mistakenly release its own handle early (typically this is only an issue when cleaning up after a failure, in which case under the new scheme this would be an innocuous error)
Attachments
Issue Links
- is duplicated by
-
CASSANDRA-8699 SSTableRewriter.abort() can throw an exception when closing the open writer
- Resolved
- is related to
-
CASSANDRA-7000 Assertion in SSTableReader during repair.
- Resolved
-
CASSANDRA-7220 Nodes hang with 100% CPU load
- Resolved
-
CASSANDRA-7704 FileNotFoundException during STREAM-OUT triggers 100% CPU usage
- Resolved
-
CASSANDRA-8061 tmplink files are not removed
- Resolved
-
CASSANDRA-7262 During streaming: java.lang.AssertionError: Reference counter -1
- Resolved
- relates to
-
CASSANDRA-8386 Make sure we release references to sstables after incremental repair
- Resolved
-
CASSANDRA-8513 SSTableScanner may not acquire reference, but will still release it when closed
- Resolved
-
CASSANDRA-8506 Improve management of DataTracker, esp. compacting
- Resolved