Comments (5)
@nitsanw Is that okay? see OOM can cause linked array qs to break #355
from jctools.
Please tell me the version of JCTools you are using, I can’t find the relevant code in the latest 4.0.1.
from jctools.
@nitsanw
Currently only modify BaseMpscLinkedArrayQueue.java poll() and peek, several other classes BaseMpscLinkedAtomicArrayQueue, BaseMpscLinkedUnpaddedArrayQueue have not been modified, if my solution is correct I'll then update the others as well. I also submitted a PR. #381
from jctools.
In this PR #371, the author also wants to get data as much as possible. But @franz1981 thinks that we should follow the principle of "fast failure", instead of using spin to consume CPU. Therefore, I think your suggestion may not be accepted.
from jctools.
Thanks for reporting, repeating my comment from the PR:
Your error is here:
cIndex-pIndex==0 , Empty
No, (cIndex-pIndex/2==0)
is the empty condition. That's why we have that as the entry condition for emptiness with the comment // isEmpty?
and why isEmpty()
is implemented the way it is.
The edge case being decided here is that if the queue is resizing when empty, it is still empty.
More reasoning:
This is an avenue we have intentionally decided not to go down. It is consistent between poll
/peek
/size
/isEmpty
/iterator
etc. And yes, people with chunk size 2 can hit this frequently, but they are also making a configuration error. These queues don't really make much sense with chunk size less than cache line (8 or 16 elements, depending on oop size).
from jctools.
Related Issues (20)
- XADD qs can save using a shared int field to coordinate new buffer appenders? HOT 1
- `NonBlockingHashSet` retains deleted values HOT 6
- OOM can cause linked array qs to break HOT 2
- Add recommended GraalVM native reflect-config.json HOT 4
- ReadObject comments HOT 3
- Code optimization suggestions HOT 1
- Unexpected jctools-core 3.3.1-ea release HOT 2
- O(1) insertion, fully non-blocking data structure HOT 4
- Publish test jar as part of the release
- any plans on fitting virtual threads HOT 1
- Missing `Automatic-Module-Name` in 4.0.1 (regression) HOT 2
- Add a parallel `forEach()` method in `NonBlockingHashMap` HOT 2
- Counters probe can be negative (and shouldn't?) HOT 3
- Add copyright information HOT 1
- MpscBlockingConsumerArrayQueue need override clear() method to avoid blocking when queue is empty HOT 2
- NonBlockingHashMap's computeIfAbsentc has a bug in a multithreaded environment HOT 11
- about spmc broadcast problem HOT 2
- the way of MpscBlockingConsumerArrayQueue provide offerFirst? HOT 1
- BaseMpscLinkedArrayQueue.peek() causes 100% CPU util [problem in caller code] HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jctools.