Project

General

Profile

Bug #14171

can't alloc thread (ThreadError) in DRbServer#main_loop

Added by Eregon (Benoit Daloze) about 1 year ago. Updated 12 months ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 2.5.0dev (2017-12-12 trunk 61147) [x86_64-linux]
[ruby-core:84213]

Description

The bug can be reproduced by adding Thread.report_on_exception = true at the top of lib/drb/drb.rb.

DRbTests::TestBug4409#test_bug4409#<Thread:0x000055597db83478@ruby/lib/drb/drb.rb:1657 aborting> terminated with exception:
Traceback (most recent call last):
    4: from ruby/lib/drb/drb.rb:1665:in `block in main_loop'
    3: from ruby/lib/drb/drb.rb:1665:in `loop'
    2: from ruby/lib/drb/drb.rb:1679:in `block (2 levels) in main_loop'
    1: from ruby/lib/drb/drb.rb:1677:in `ensure in block (2 levels) in main_loop'
ruby/lib/drb/drb.rb:1677:in `new': can't alloc thread (ThreadError)

This Thread.new fails:

if Thread.current['DRb']['stop_service']
  Thread.new { stop_service }
end

I think we don't need an extra Thread to stop the DRbServer.
We just need to tweak the logic in DRbServer#stop_service.

Proposed patch attached.
I need to commit it soon to avoid hundreds of warnings during make test-all for #14143.

seki (Masatoshi Seki) Could you review?

Associated revisions

Revision ca1c3d41
Added by Eregon (Benoit Daloze) about 1 year ago

Avoid creating a Thread for shutting down a DRbServer

  • lib/drb/drb.rb: avoid creating a Thread and call the shutdown logic directly. Do not try to kill or join the current Thread. Thread.new { stop_service } caused "can't alloc thread (ThreadError)", which is shown with Thread.report_on_exception = true. [Bug #14171]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 61184
Added by Eregon (Benoit Daloze) about 1 year ago

Avoid creating a Thread for shutting down a DRbServer

  • lib/drb/drb.rb: avoid creating a Thread and call the shutdown logic directly. Do not try to kill or join the current Thread. Thread.new { stop_service } caused "can't alloc thread (ThreadError)", which is shown with Thread.report_on_exception = true. [Bug #14171]

Revision 61184
Added by Eregon (Benoit Daloze) about 1 year ago

Avoid creating a Thread for shutting down a DRbServer

  • lib/drb/drb.rb: avoid creating a Thread and call the shutdown logic directly. Do not try to kill or join the current Thread. Thread.new { stop_service } caused "can't alloc thread (ThreadError)", which is shown with Thread.report_on_exception = true. [Bug #14171]

History

#1 Updated by Eregon (Benoit Daloze) about 1 year ago

  • Target version set to 2.5

#2 Updated by Eregon (Benoit Daloze) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset trunk|r61184.


Avoid creating a Thread for shutting down a DRbServer

  • lib/drb/drb.rb: avoid creating a Thread and call the shutdown logic directly. Do not try to kill or join the current Thread. Thread.new { stop_service } caused "can't alloc thread (ThreadError)", which is shown with Thread.report_on_exception = true. [Bug #14171]

Also available in: Atom PDF