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

Stefania commented on CASSANDRA-8897:
-------------------------------------

bq. If we double-free, it's a bug, and should be an assertion failure, not a 
silent success.

Agreed but unfortunately the assertion could also be a cryptic ref already 
released on the attachment:

{code}
java.lang.AssertionError
    at 
org.apache.cassandra.utils.concurrent.Ref$State.assertNotReleased(Ref.java:157)
    at org.apache.cassandra.utils.concurrent.Ref.get(Ref.java:99)
    at 
org.apache.cassandra.utils.memory.BufferPool$Chunk.getParentChunk(BufferPool.java:532)
    at 
org.apache.cassandra.utils.memory.BufferPool$LocalPool.put(BufferPool.java:369)
    at org.apache.cassandra.utils.memory.BufferPool.put(BufferPool.java:111)
    at 
org.apache.cassandra.utils.memory.BufferPoolTest.doMultipleThreadsReleaseBuffers(BufferPoolTest.java:820)
    at 
org.apache.cassandra.utils.memory.BufferPoolTest.testMultipleThreadsReleaseDifferentBuffer(BufferPoolTest.java:764)
{code}

Is this still OK?

bq. a thread could be executing maybeRecycle, have performed the check to 
confirm it should recycle, and then suspend. The allocating thread could then 
alliocate a buffer,

I cannot see the race because only the owning thread can recycle and other 
threads do not have access until the buffer is back in the global pool queue, 
please refer to the comments in the code.

bq. The burn test reports this sort of errors with if (index == 64) in get():

The searchMask was picking up extra 1 bits on the left, as soon as the index 
reached 31.
I changed {{searchMask ^= 1 << index;}} to {{searchMask ^= 1L << index;}} and 
that fixed it.
If you want to check it out further you can use 
{{BufferPoolTest.testBuffersWithGivenSlots()}} to reproduce it.

More details in the code.

I also rebased.

> Remove FileCacheService, instead pooling the buffers
> ----------------------------------------------------
>
>                 Key: CASSANDRA-8897
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8897
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Benedict
>            Assignee: Stefania
>             Fix For: 3.x
>
>         Attachments: 9240_test_results.txt, 
> snapshot-1431582436640-cpu-backtraces.png, 
> snapshot-1431582436640-cpu-calltree-compression-8897.nps, 
> snapshot-1431582436640-cpu-calltree-compression-trunk.nps
>
>
> After CASSANDRA-8893, a RAR will be a very lightweight object and will not 
> need caching, so we can eliminate this cache entirely. Instead we should have 
> a pool of buffers that are page-aligned.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to