Open qwwdfsad opened 1 year ago
I just spotted a 1-core 100% CPU usage (I've 8 cores in total) after hours of idling at 0% in my application.
According to top -H
, 100% of my application CPU usage is caused by the DefaultDispatcher
thread. Looking at the thread dump, it only has this one stack:
kotlinx.coroutines.internal.LockFreeLinkedListNode.removeOrNext(LockFreeLinkedList.kt:208) DefaultDispatcher-worker-6
After profiling, JMC shows the most sampled method to be, by far, LockFreeLinkedListNode.getNext()
.
Could this be related to these described issues and will it be fixed with the removal of the implementation? I'm using Kotlin 2.0.10 + kotlinx.coroutines 1.8.1 - will upgrade in a sec and see if I can reproduce it with 1.9.0. Application source
We have
LockFreeLinkedListNode
and co. based on the "Lock-Free and Practical Doubly Linked List-Based Deques Using Single-Word Compare-and-Swap" paper.The implementation has a long-standing tail of issues:
kotlinx.coroutines
.The proposed solution is straightforward -- get rid of DCLL and replace it with recently added FADD-based
ConcurrentLinkedList
that semaphore, mutex and channels leverage