Skip to content

Commit

Permalink
shut down jruby executors
Browse files Browse the repository at this point in the history
JRuby executors are not shutting down, causing a build-up of JRuby
worker threads.  A patch for JRuby has been submitted
<jruby/jruby#6127> but until merged and
puppetserver updated to use the new version this change will
explicitly shut down the worker threads.
  • Loading branch information
ProfessorEugene authored and svartulfv committed Apr 3, 2020
1 parent c72a289 commit 1306369
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/java/com/puppetlabs/puppetserver/JRubyPuppet.java
Expand Up @@ -6,7 +6,7 @@
/**
*
* This interface is a bridge between the clojure/Java code and the ruby class
* `JRubyPuppet`. (defined in `src/ruby/puppetserver-lib/jruby_puppet.rb`.)
* `JRubyPuppet`. (defined in `src/ruby/puppetserver-lib/puppet/server/master.rb`.)
* The ruby class uses some JRuby magic that causes it to "implement" the Java
* interface.
*
Expand Down
5 changes: 5 additions & 0 deletions src/ruby/puppetserver-lib/puppet/server/master.rb
Expand Up @@ -14,6 +14,7 @@
require 'puppet/server/key_recorder'
require 'puppet/server/settings'
require 'java'
require 'timeout'

##
## This class is a bridge between the puppet ruby code and the java interface
Expand Down Expand Up @@ -149,6 +150,10 @@ def run_mode()

def terminate
Puppet::Server::Config.terminate_puppet_server
# executor shutdown can be removed after puppetserver upgrades to a version of jruby
# following merge of https://github.com/jruby/jruby/pull/6127
executor = Timeout.to_java.getInternalVariable('__executor__')
executor.shutdown
end

# @return [Array, nil] an array of hashes describing tasks
Expand Down

0 comments on commit 1306369

Please sign in to comment.