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

Benedict Elliott Smith commented on CASSANDRA-16681:
----------------------------------------------------

bq. The thread check was the only thing needed to correct for that particular 
problem described in point 1.

If you want to submit a patch that modifies only this, I can review it simply. 
It retains the problem I mentioned before, of preventing an allocator being 
safely shared between threads, and it does so unnecessarily. But I'm fine with 
it.

bq. The fact it was broken and multiple people didn't see it for many months 
already proves the property of "only one thread can enter here" is totally not 
obvious.

The amount of time is sort of meaningless here, since nobody is looking at it. 
The problem here was that ownership was being calculated by the method itself; 
by calculating it in the caller we must consider at each call-site if this can 
be known, and if not propagate the parameter to the caller (until we do know). 
So, I think this adequately mitigates the risk.

bq. LocalPool's put is called from the main API of the BufferPool

I suggested overloading this method, so the overload with the additional method 
can be made private to indicate it is not a part of the "main API" (although 
this is all internal to the class, so this is only communicative to the reader)

bq. But what about the already evicted tiny buffers? Owner == null for those.

Good point. Perhaps my proposal of making `MicroQueueOfChunks` thread-safe is 
superior, then, so that we may in fact recycle these in all cases and avoid 
more pathological situations if tiny buffers are shared between threads?



> org.apache.cassandra.utils.memory.LongBufferPoolTest - tests are flaky
> ----------------------------------------------------------------------
>
>                 Key: CASSANDRA-16681
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16681
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CI
>            Reporter: Ekaterina Dimitrova
>            Assignee: Piotr Kolaczkowski
>            Priority: Normal
>             Fix For: 3.11.x, 4.0.x, 4.x
>
>         Attachments: 0001-Fix-memoryInUse-counter-in-BufferPool.patch, 
> 0002-Multiple-fixes-in-BufferPool-and-LongBufferPoolTest.patch
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Jenkins history:
> [https://jenkins-cm4.apache.org/job/Cassandra-4.0/50/testReport/junit/org.apache.cassandra.utils.memory/LongBufferPoolTest/testPoolAllocateWithRecyclePartially/history/]
> Fails being run in a loop in CircleCI:
> https://app.circleci.com/pipelines/github/ekaterinadimitrova2/cassandra/844/workflows/945011f4-00ac-4678-89f6-5c0db0a40169/jobs/5008
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to