ruby-concurrency / ruby-concurrency/concurrent-ruby

concurrent-ruby-edge Channel.select consumes full(single core) cpu

Open
#883 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.