ruby-concurrency / ruby-concurrency/concurrent-ruby
concurrent-ruby-edge Channel.select consumes full(single core) cpu
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 5.8k
- Forks
- 420
- Avg merge
- 20h 45m
- Merged PRs (30d)
- 4
Description
* `concurrent-ruby` version: 1.1.7
* `concurrent-ruby-edge` used: yes
I am running this simple code and I see that select is not blocking on the channels and instead always looping which consumes full(single core) CPU.
require 'concurrent-edge'
Channel = Concurrent::Channel
string1 = Channel.new
string2 = Channel.new
loop do
Channel.select do |s|
s.take(string1) {
puts "string1"
}
s.take(string2) {
puts "string2"
}
end
end
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied concurrent-ruby-edge reproduction and then trace the Channel.select entry point and its channel-waiting behavior. Done means select blocks when both channels are empty and the loop no longer consumes a full CPU core, while still handling values sent to either channel.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100