Celluloid memory leak in irb #135

Closed
dzhulk opened this Issue Dec 12, 2012 · 3 comments

Comments

Projects
None yet
2 participants

dzhulk commented Dec 12, 2012

require "rubygems"
require "celluloid"

module A
  class Worker
    include Celluloid
    def initialize(manager)
      @manager = manager
    end
  end

  class Manager
    include Celluloid
    def initialize
      @worker = Worker.new(Actor.current)
    end
  end
end

A::Manager.new

This code works well when run as script

➜  tmp  ruby celltest.rb 
D, [2012-12-12T16:19:07.225383 #76176] DEBUG -- : Terminating 4 actors...
D, [2012-12-12T16:19:07.226416 #76176] DEBUG -- : Shutdown completed cleanly
➜  tmp  

but when it runned in irb

➜  tmp  irb
irb(main):001:0> require "./celltest"
=> true
irb(main):002:0> A::Manager.new
^CIRB::Abort: abort then interrupt!
    from /Users/murat/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/thread.rb:71:in `call'
    from /Users/murat/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/thread.rb:71:in `sleep'
    from /Users/murat/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/thread.rb:71:in `wait'
    from /Users/murat/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/celluloid-0.12.4/lib/celluloid/mailbox.rb:66:in `receive'
    from /Users/murat/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/celluloid-0.12.4/lib/celluloid/actor.rb:73:in `block in call'
    from /Users/murat/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/celluloid-0.12.4/lib/celluloid/actor.rb:72:in `loop'
    from /Users/murat/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/celluloid-0.12.4/lib/celluloid/actor.rb:72:in `call'
    from /Users/murat/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/celluloid-0.12.4/lib/celluloid/proxies/actor_proxy.rb:26:in `inspect'
    from /Users/murat/.rbenv/versions/1.9.3-p327/bin/irb:12:in `<main>'
irb(main):003:0> quit
D, [2012-12-12T16:19:54.453153 #76205] DEBUG -- : Terminating 6 actors...
D, [2012-12-12T16:20:01.379379 #76205] DEBUG -- : Shutdown completed cleanly
➜  tmp  

in irb memory usage grows and A::Manager.new never ends

Owner

tarcieri commented Dec 12, 2012

This is a dupe of #22

@tarcieri tarcieri closed this Dec 12, 2012

Owner

tarcieri commented Dec 12, 2012

Note: you can fix this by redefining #inspect for either actor so it doesn't reference the previous one.

dzhulk commented Dec 12, 2012

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment