Skip to content

Commit

Permalink
Set DRb conn pool to [] after closing connections
Browse files Browse the repository at this point in the history
After forking and closing open DRb pooled connections set the pool to []
to prevent other calls calling `conn.close` on already closed
connection.  This prevents the following:

```
[NoMethodError]: undefined method `close' for nil:NilClass
Did you mean?  clone
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1258:in `close'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1237:in `block in open'
/opt/rh/rh-ruby23/root/usr/share/ruby/sync.rb:234:in `block in sync_synchronize'
/opt/rh/rh-ruby23/root/usr/share/ruby/sync.rb:231:in `handle_interrupt'
/opt/rh/rh-ruby23/root/usr/share/ruby/sync.rb:231:in `sync_synchronize'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1235:in `open'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1141:in `block in method_missing'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1160:in `with_friend'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1140:in `method_missing'
lib/gems/pending/VMwareWebService/MiqVimBroker.rb:419:in `getMiqVim'
```

https://bugzilla.redhat.com/show_bug.cgi?id=1562401
  • Loading branch information
agrare committed Apr 9, 2018
1 parent c9e7f02 commit 76309b9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/models/miq_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def self.close_drb_pool_connections
# Once that is added this should be replaced.
DRb::DRbConn.instance_variable_get(:@mutex).synchronize do
DRb::DRbConn.instance_variable_get(:@pool).each(&:close)
DRb::DRbConn.instance_variable_set(:@pool, [])
end
end

Expand Down

0 comments on commit 76309b9

Please sign in to comment.