Skip to content

Commit aeed449

Browse files
committed
Fix global IO pool on JRuby
Use CachedThreadPool instead of configured ThreadPoolExecutor to make sure that arriving jobs are passed to newly created threads instead put into queue when there are no idle threads. Prevents deadlocking when jobs depend on each other.
1 parent 08a4aec commit aeed449

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib/concurrent/configuration.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,8 @@ def self.new_fast_executor(opts = {})
175175
end
176176

177177
def self.new_io_executor(opts = {})
178-
ThreadPoolExecutor.new(
179-
min_threads: [2, Concurrent.processor_count].max,
180-
max_threads: ThreadPoolExecutor::DEFAULT_MAX_POOL_SIZE,
181-
# max_threads: 1000,
178+
CachedThreadPool.new(
182179
auto_terminate: opts.fetch(:auto_terminate, true),
183-
idletime: 60, # 1 minute
184-
max_queue: 0, # unlimited
185180
fallback_policy: :abort # shouldn't matter -- 0 max queue
186181
)
187182
end

0 commit comments

Comments
 (0)