Bug 261141 - sysutils/puppetserver7 with routes.yaml not compatible with rubygem-psych-4
Summary: sysutils/puppetserver7 with routes.yaml not compatible with rubygem-psych-4
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: FreeBSD Puppet Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-12 10:01 UTC by Andre Rikkert de Koe - ARK-ICT
Modified: 2025-05-18 17:49 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (puppet)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Rikkert de Koe - ARK-ICT 2022-01-12 10:01:19 UTC
https://puppet.com/docs/puppet/7/config_file_routes.html decribes how to
create a routes.yaml file to configure puppetserver to use puppetdb

I use rubygem-psych to parse the yaml code.
Only with latest rubygem-psych, the service puppetserver7 will not start and logs following error in /var/log/puppetserver/puppetserver.log :

Caused by: org.jruby.exceptions.RuntimeError: (YamlLoadError) wrong number of arguments (given 5, expected 1)
        at RUBY.safe_load(/usr/local/lib/ruby/site_ruby/2.7/puppet/util/yaml.rb:34)

Note that yaml.rb actually belongs to puppet7 package not puppetserver7, but the error prevents puppetserver7 to start.
Comment 1 Andre Rikkert de Koe - ARK-ICT 2022-01-12 10:07:22 UTC
I think this has to do with new API format for safe_load in rubygem-psych that uses 1 argument
now (version 4.0.3) instead of more arguments in older versions like (3.3.1)

Workaround for me was to use portdowngrade to downgrade rubygem-psych to version 3.3.1.
After that puppetserver starts normally

my working configuration :

puppet7-7.13.1                 Configuration management framework written in Ruby
puppetdb-terminus7-7.8.0       PuppetDB storeconfigs backend terminus module
puppetdb7-7.8.0                PuppetDB storeconfigs backend
puppetserver7-7.5.0            Puppet Server running in the JVM
rubygem-psych-3.3.1            YAML parser and emitter

Technically rubygem-psych seems not to be configured as dependency in the puppet ports so technically it's not a bug.
But the issue and workaround might be useful to file as a PR.
Comment 2 Romain Tartière freebsd_committer freebsd_triage 2022-01-17 20:00:12 UTC
Thanks for this report.

Upstream seems to be aware of the issue and the next versions of Puppet (7.14.0, 6.26.0) will hopefully fix it.

Issue tracked at Puppet:
https://tickets.puppetlabs.com/browse/PUP-11405?jql=text%20~%20%22psych%22

Actual fix:
https://github.com/puppetlabs/puppet/pull/8849


New versions of PuppetServer and PuppetDB have been tagged a couple days ago, so I expect a Puppet release to tagged soon, and the updated "Puppet Platform" to be available / announced in the next few days.  We usually wait for the new release to be announced before updating the ports.  Stay tuned!
Comment 3 Romain Tartière freebsd_committer freebsd_triage 2022-01-21 20:00:01 UTC
Hey!

Update committed, should be fine now.

Thanks!
Comment 4 Andre Rikkert de Koe - ARK-ICT 2022-01-22 07:38:28 UTC
(In reply to Romain Tartière from comment #3)

hi Romain,

Current portstree :

puppet7-7.14.0                 Configuration management framework written in Ruby
puppetdb-terminus7-7.9.0       PuppetDB storeconfigs backend terminus module
puppetdb7-7.9.0                PuppetDB storeconfigs backend
puppetserver7-7.6.0            Puppet Server running in the JVM

is still not compatible with rubygem-psych-4.0.3.
Though error message is different.
My workaround is to downgrade or remove rubygem-psych-4.0.3

This is my content of /var/log/puppetserver/puppetserver.log when starting pupppetserver with current portstree including rubygem-psych-4.0.3 :

2022-01-22T08:29:34.331+01:00 INFO  [main] [o.e.j.u.log] Logging initialized @4956ms to org.eclipse.jetty.util.log.Slf4jLog
2022-01-22T08:29:35.185+01:00 INFO  [async-dispatch-2] [p.t.s.s.scheduler-service] Initializing Scheduler Service
2022-01-22T08:29:35.209+01:00 INFO  [async-dispatch-2] [o.q.i.StdSchedulerFactory] Using default implementation for ThreadExecutor
2022-01-22T08:29:35.220+01:00 INFO  [async-dispatch-2] [o.q.c.SchedulerSignalerImpl] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2022-01-22T08:29:35.220+01:00 INFO  [async-dispatch-2] [o.q.c.QuartzScheduler] Quartz Scheduler v.2.3.2 created.
2022-01-22T08:29:35.221+01:00 INFO  [async-dispatch-2] [o.q.s.RAMJobStore] RAMJobStore initialized.
2022-01-22T08:29:35.223+01:00 INFO  [async-dispatch-2] [o.q.c.QuartzScheduler] Scheduler meta-data: Quartz Scheduler (v2.3.2) '54393f5c-476a-44d9-93d3-78ba509e68eb' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
  Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

2022-01-22T08:29:35.224+01:00 INFO  [async-dispatch-2] [o.q.i.StdSchedulerFactory] Quartz scheduler '54393f5c-476a-44d9-93d3-78ba509e68eb' initialized from an externally provided properties instance.
2022-01-22T08:29:35.224+01:00 INFO  [async-dispatch-2] [o.q.i.StdSchedulerFactory] Quartz scheduler version: 2.3.2
2022-01-22T08:29:35.224+01:00 INFO  [async-dispatch-2] [o.q.c.QuartzScheduler] Scheduler 54393f5c-476a-44d9-93d3-78ba509e68eb_$_NON_CLUSTERED started.
2022-01-22T08:29:35.226+01:00 INFO  [async-dispatch-2] [p.t.s.w.jetty9-service] Initializing web server(s).
2022-01-22T08:29:35.270+01:00 INFO  [async-dispatch-2] [p.t.s.s.status-service] Registering status callback function for service 'puppet-profiler', version 7.6.0
2022-01-22T08:29:35.272+01:00 INFO  [async-dispatch-2] [p.s.j.jruby-puppet-service] Initializing the JRuby service
2022-01-22T08:29:35.285+01:00 INFO  [async-dispatch-2] [p.s.j.jruby-pool-manager-service] Initializing the JRuby service
2022-01-22T08:29:35.291+01:00 INFO  [async-dispatch-2] [p.s.j.jruby-puppet-service] JRuby version info: jruby 9.2.17.0 (2.5.8) 2021-03-29 84d363da97 OpenJDK 64-Bit Server VM 25.312-b07 on 1.8.0_312-b07 +jit [freebsd-x86_64]
2022-01-22T08:29:35.300+01:00 INFO  [clojure-agent-send-pool-0] [p.s.j.i.jruby-internal] Creating JRubyInstance with id 1.
2022-01-22T08:29:35.309+01:00 INFO  [async-dispatch-2] [p.t.s.s.status-service] Registering status callback function for service 'jruby-metrics', version 7.6.0
2022-01-22T08:29:38.544+01:00 ERROR [clojure-agent-send-pool-0] [p.t.internal] shutdown-on-error triggered because of exception!
java.lang.IllegalStateException: There was a problem adding a JRubyInstance to the pool.
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34359$add_instance__34364$fn__34368.invoke(jruby_agents.clj:58)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34359$add_instance__34364.invoke(jruby_agents.clj:47)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34386$prime_pool_BANG___34391$fn__34395.invoke(jruby_agents.clj:76)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34386$prime_pool_BANG___34391.invoke(jruby_agents.clj:61)
	at puppetlabs.services.jruby_pool_manager.impl.instance_pool$fn__34948$fn__34949.invoke(instance_pool.clj:16)
	at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invokeStatic(internal.clj:403)
	at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invoke(internal.clj:378)
	at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invokeStatic(internal.clj:388)
	at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invoke(internal.clj:378)
	at puppetlabs.trapperkeeper.internal$fn__14976$shutdown_service__14981$fn$reify__14983$service_fnk__5102__auto___positional$reify__14988.shutdown_on_error(internal.clj:448)
	at puppetlabs.trapperkeeper.internal$fn__14906$G__14902__14914.invoke(internal.clj:411)
	at puppetlabs.trapperkeeper.internal$fn__14906$G__14901__14923.invoke(internal.clj:411)
	at clojure.core$partial$fn__5839.invoke(core.clj:2625)
	at clojure.core$partial$fn__5839.invoke(core.clj:2624)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34333$send_agent__34338$fn__34339$agent_fn__34340.invoke(jruby_agents.clj:41)
	at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2033)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.lang.Agent$Action.doRun(Agent.java:114)
	at clojure.lang.Agent$Action.run(Agent.java:163)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.jruby.embed.EvalFailedException: (LoadError) no such file to load -- /usr/local/lib/ruby/gems/2.7/gems/psych-4.0.3/lib/psych_jars
	at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:131)
	at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1295)
	at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1288)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:167)
	at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:102)
	at puppetlabs.services.jruby.jruby_puppet_core$fn__36167$get_initialize_pool_instance_fn__36172$fn__36173$fn__36174.invoke(jruby_puppet_core.clj:118)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_internal$fn__33941$create_pool_instance_BANG___33950$fn__33953.invoke(jruby_internal.clj:256)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_internal$fn__33941$create_pool_instance_BANG___33950.invoke(jruby_internal.clj:225)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34359$add_instance__34364$fn__34368.invoke(jruby_agents.clj:52)
	... 22 common frames omitted
Caused by: org.jruby.exceptions.LoadError: (LoadError) no such file to load -- /usr/local/lib/ruby/gems/2.7/gems/psych-4.0.3/lib/psych_jars
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/gems/2.7/gems/psych-4.0.3/lib/psych.rb:5)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at usr.local.lib.ruby.site_ruby.$2_dot_7.rubygems.core_ext.kernel_require.require(/usr/local/lib/ruby/site_ruby/2.7/rubygems/core_ext/kernel_require.rb:54)
	at RUBY.<main>(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/yaml.rb:6)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at usr.local.lib.ruby.site_ruby.$2_dot_7.rubygems.core_ext.kernel_require.require(/usr/local/lib/ruby/site_ruby/2.7/rubygems/core_ext/kernel_require.rb:54)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/network/format_handler.rb:1)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/network/format_support.rb:1)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/util/tag_set.rb:2)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/util/tagging.rb:2)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/util/log.rb:1)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/util/logging.rb:2)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/util.rb:794)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet.rb:16)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at RUBY.require(/usr/local/lib/ruby/site_ruby/2.7/rubygems/core_ext/kernel_require.rb:54)
	at RUBY.<main>(uri:classloader:/puppetserver-lib/puppet/server.rb:1)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at RUBY.require(/usr/local/lib/ruby/site_ruby/2.7/rubygems/core_ext/kernel_require.rb:54)
	at RUBY.<main>(uri:classloader:/puppetserver-lib/puppet/server/master.rb:1)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at RUBY.require(/usr/local/lib/ruby/site_ruby/2.7/rubygems/core_ext/kernel_require.rb:54)
	at RUBY.<main>(<script>:1)
2022-01-22T08:29:38.544+01:00 ERROR [async-dispatch-2] [p.t.internal] Error during service init!!!
java.lang.IllegalStateException: Unable to borrow JRubyInstance from pool
	at puppetlabs.services.jruby_pool_manager.impl.jruby_internal$fn__34141$borrow_from_pool_BANG__STAR___34146$fn__34147.invoke(jruby_internal.clj:313)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_internal$fn__34141$borrow_from_pool_BANG__STAR___34146.invoke(jruby_internal.clj:300)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_internal$fn__34188$borrow_from_pool_with_timeout__34193$fn__34194.invoke(jruby_internal.clj:348)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_internal$fn__34188$borrow_from_pool_with_timeout__34193.invoke(jruby_internal.clj:337)
	at puppetlabs.services.jruby_pool_manager.impl.instance_pool$fn__34952.invokeStatic(instance_pool.clj:48)
	at puppetlabs.services.jruby_pool_manager.impl.instance_pool$fn__34952.invoke(instance_pool.clj:10)
	at puppetlabs.services.protocols.jruby_pool$fn__34777$G__34690__34784.invoke(jruby_pool.clj:3)
	at puppetlabs.services.jruby_pool_manager.jruby_core$fn__35866$borrow_from_pool_with_timeout__35871$fn__35872.invoke(jruby_core.clj:222)
	at puppetlabs.services.jruby_pool_manager.jruby_core$fn__35866$borrow_from_pool_with_timeout__35871.invoke(jruby_core.clj:209)
	at puppetlabs.services.config.puppet_server_config_core$fn__43959$get_puppet_config__43964$fn__43965$fn__43966.invoke(puppet_server_config_core.clj:107)
	at puppetlabs.services.config.puppet_server_config_core$fn__43959$get_puppet_config__43964$fn__43965.invoke(puppet_server_config_core.clj:107)
	at puppetlabs.services.config.puppet_server_config_core$fn__43959$get_puppet_config__43964.invoke(puppet_server_config_core.clj:102)
	at puppetlabs.services.config.puppet_server_config_service$reify__43994$service_fnk__5102__auto___positional$reify__44005.init(puppet_server_config_service.clj:25)
	at puppetlabs.trapperkeeper.services$fn__4926$G__4918__4929.invoke(services.clj:9)
	at puppetlabs.trapperkeeper.services$fn__4926$G__4917__4933.invoke(services.clj:9)
	at puppetlabs.trapperkeeper.internal$fn__14471$run_lifecycle_fn_BANG___14478$fn__14479.invoke(internal.clj:196)
	at puppetlabs.trapperkeeper.internal$fn__14471$run_lifecycle_fn_BANG___14478.invoke(internal.clj:179)
	at puppetlabs.trapperkeeper.internal$fn__14500$run_lifecycle_fns__14505$fn__14506.invoke(internal.clj:229)
	at puppetlabs.trapperkeeper.internal$fn__14500$run_lifecycle_fns__14505.invoke(internal.clj:206)
	at puppetlabs.trapperkeeper.internal$fn__15125$build_app_STAR___15134$fn$reify__15146.init(internal.clj:602)
	at puppetlabs.trapperkeeper.internal$fn__15173$boot_services_for_app_STAR__STAR___15180$fn__15181$fn__15183.invoke(internal.clj:630)
	at puppetlabs.trapperkeeper.internal$fn__15173$boot_services_for_app_STAR__STAR___15180$fn__15181.invoke(internal.clj:629)
	at puppetlabs.trapperkeeper.internal$fn__15173$boot_services_for_app_STAR__STAR___15180.invoke(internal.clj:623)
	at clojure.core$partial$fn__5841.invoke(core.clj:2630)
	at puppetlabs.trapperkeeper.internal$fn__14545$initialize_lifecycle_worker__14556$fn__14557$fn__14707$state_machine__11705__auto____14732$fn__14735.invoke(internal.clj:249)
	at puppetlabs.trapperkeeper.internal$fn__14545$initialize_lifecycle_worker__14556$fn__14557$fn__14707$state_machine__11705__auto____14732.invoke(internal.clj:249)
	at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:973)
	at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:972)
	at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:977)
	at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:975)
	at clojure.core.async$ioc_alts_BANG_$fn__11920.invoke(async.clj:384)
	at clojure.core.async$do_alts$fn__11860$fn__11863.invoke(async.clj:253)
	at clojure.core.async.impl.channels.ManyToManyChannel$fn__6524$fn__6525.invoke(channels.clj:95)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.jruby.embed.EvalFailedException: (LoadError) no such file to load -- /usr/local/lib/ruby/gems/2.7/gems/psych-4.0.3/lib/psych_jars
	at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:131)
	at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1295)
	at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1288)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:167)
	at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:102)
	at puppetlabs.services.jruby.jruby_puppet_core$fn__36167$get_initialize_pool_instance_fn__36172$fn__36173$fn__36174.invoke(jruby_puppet_core.clj:118)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_internal$fn__33941$create_pool_instance_BANG___33950$fn__33953.invoke(jruby_internal.clj:256)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_internal$fn__33941$create_pool_instance_BANG___33950.invoke(jruby_internal.clj:225)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34359$add_instance__34364$fn__34368.invoke(jruby_agents.clj:52)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34359$add_instance__34364.invoke(jruby_agents.clj:47)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34386$prime_pool_BANG___34391$fn__34395.invoke(jruby_agents.clj:76)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34386$prime_pool_BANG___34391.invoke(jruby_agents.clj:61)
	at puppetlabs.services.jruby_pool_manager.impl.instance_pool$fn__34948$fn__34949.invoke(instance_pool.clj:16)
	at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invokeStatic(internal.clj:403)
	at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invoke(internal.clj:378)
	at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invokeStatic(internal.clj:388)
	at puppetlabs.trapperkeeper.internal$shutdown_on_error_STAR_.invoke(internal.clj:378)
	at puppetlabs.trapperkeeper.internal$fn__14976$shutdown_service__14981$fn$reify__14983$service_fnk__5102__auto___positional$reify__14988.shutdown_on_error(internal.clj:448)
	at puppetlabs.trapperkeeper.internal$fn__14906$G__14902__14914.invoke(internal.clj:411)
	at puppetlabs.trapperkeeper.internal$fn__14906$G__14901__14923.invoke(internal.clj:411)
	at clojure.core$partial$fn__5839.invoke(core.clj:2625)
	at clojure.core$partial$fn__5839.invoke(core.clj:2624)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34333$send_agent__34338$fn__34339$agent_fn__34340.invoke(jruby_agents.clj:41)
	at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2033)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.lang.Agent$Action.doRun(Agent.java:114)
	at clojure.lang.Agent$Action.run(Agent.java:163)
	... 3 common frames omitted
Caused by: org.jruby.exceptions.LoadError: (LoadError) no such file to load -- /usr/local/lib/ruby/gems/2.7/gems/psych-4.0.3/lib/psych_jars
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/gems/2.7/gems/psych-4.0.3/lib/psych.rb:5)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at usr.local.lib.ruby.site_ruby.$2_dot_7.rubygems.core_ext.kernel_require.require(/usr/local/lib/ruby/site_ruby/2.7/rubygems/core_ext/kernel_require.rb:54)
	at RUBY.<main>(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/yaml.rb:6)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at usr.local.lib.ruby.site_ruby.$2_dot_7.rubygems.core_ext.kernel_require.require(/usr/local/lib/ruby/site_ruby/2.7/rubygems/core_ext/kernel_require.rb:54)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/network/format_handler.rb:1)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/network/format_support.rb:1)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/util/tag_set.rb:2)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/util/tagging.rb:2)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/util/log.rb:1)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/util/logging.rb:2)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet/util.rb:794)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel.require_relative(org/jruby/RubyKernel.java:1002)
	at RUBY.<main>(/usr/local/lib/ruby/site_ruby/2.7/puppet.rb:16)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at RUBY.require(/usr/local/lib/ruby/site_ruby/2.7/rubygems/core_ext/kernel_require.rb:54)
	at RUBY.<main>(uri:classloader:/puppetserver-lib/puppet/server.rb:1)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at RUBY.require(/usr/local/lib/ruby/site_ruby/2.7/rubygems/core_ext/kernel_require.rb:54)
	at RUBY.<main>(uri:classloader:/puppetserver-lib/puppet/server/master.rb:1)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:974)
	at RUBY.require(/usr/local/lib/ruby/site_ruby/2.7/rubygems/core_ext/kernel_require.rb:54)
	at RUBY.<main>(<script>:1)
2022-01-22T08:29:38.549+01:00 INFO  [main] [p.t.internal] Beginning shutdown sequence
2022-01-22T08:29:38.555+01:00 INFO  [async-dispatch-3] [p.s.j.jruby-metrics-service] JRuby Metrics Service: stopping metrics sampler job
2022-01-22T08:29:38.555+01:00 INFO  [async-dispatch-3] [p.s.j.jruby-metrics-service] JRuby Metrics Service: stopped metrics sampler job
2022-01-22T08:29:38.559+01:00 INFO  [async-dispatch-3] [p.s.j.i.jruby-agents] Draining JRuby pool.
2022-01-22T08:29:38.561+01:00 ERROR [async-dispatch-3] [p.t.internal] Encountered error during shutdown sequence
java.lang.InterruptedException: Lock can't be granted because a pill has been inserted
	at com.puppetlabs.jruby_utils.pool.JRubyPool.lockWithTimeout(JRubyPool.java:368)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:167)
	at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:102)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34467$borrow_all_jrubies__34472$fn__34473$fn__34474.invoke(jruby_agents.clj:128)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34467$borrow_all_jrubies__34472$fn__34473.invoke(jruby_agents.clj:127)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34467$borrow_all_jrubies__34472.invoke(jruby_agents.clj:119)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34547$drain_and_refill_pool_BANG___34556$fn__34559.invoke(jruby_agents.clj:190)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34547$drain_and_refill_pool_BANG___34556.invoke(jruby_agents.clj:172)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34588$flush_pool_for_shutdown_BANG___34593$fn__34594.invoke(jruby_agents.clj:211)
	at puppetlabs.services.jruby_pool_manager.impl.jruby_agents$fn__34588$flush_pool_for_shutdown_BANG___34593.invoke(jruby_agents.clj:199)
	at puppetlabs.services.jruby_pool_manager.impl.instance_pool$fn__34964.invokeStatic(instance_pool.clj:20)
	at puppetlabs.services.jruby_pool_manager.impl.instance_pool$fn__34964.invoke(instance_pool.clj:10)
	at puppetlabs.services.protocols.jruby_pool$fn__34742$G__34702__34747.invoke(jruby_pool.clj:3)
	at puppetlabs.services.jruby_pool_manager.jruby_core$fn__35941$flush_pool_for_shutdown_BANG___35946$fn__35947.invoke(jruby_core.clj:250)
	at puppetlabs.services.jruby_pool_manager.jruby_core$fn__35941$flush_pool_for_shutdown_BANG___35946.invoke(jruby_core.clj:245)
	at puppetlabs.services.jruby.jruby_puppet_service$reify__36724$service_fnk__5102__auto___positional$reify__36738.stop(jruby_puppet_service.clj:50)
	at puppetlabs.trapperkeeper.services$fn__4952$G__4922__4955.invoke(services.clj:9)
	at puppetlabs.trapperkeeper.services$fn__4952$G__4921__4959.invoke(services.clj:9)
	at puppetlabs.trapperkeeper.internal$fn__14471$run_lifecycle_fn_BANG___14478$fn__14479.invoke(internal.clj:196)
	at puppetlabs.trapperkeeper.internal$fn__14471$run_lifecycle_fn_BANG___14478.invoke(internal.clj:179)
	at puppetlabs.trapperkeeper.internal$fn__15033$shutdown_BANG___15038$fn__15039$shutdown_fn__15041$fn__15056.invoke(internal.clj:459)
	at puppetlabs.trapperkeeper.internal$fn__15033$shutdown_BANG___15038$fn__15039$shutdown_fn__15041.invoke(internal.clj:458)
	at puppetlabs.trapperkeeper.internal$fn__14545$initialize_lifecycle_worker__14556$fn__14557$fn__14707$state_machine__11705__auto____14732$fn__14735$fn__14749.invoke(internal.clj:274)
	at puppetlabs.trapperkeeper.internal$fn__14545$initialize_lifecycle_worker__14556$fn__14557$fn__14707$state_machine__11705__auto____14732$fn__14735.invoke(internal.clj:258)
	at puppetlabs.trapperkeeper.internal$fn__14545$initialize_lifecycle_worker__14556$fn__14557$fn__14707$state_machine__11705__auto____14732.invoke(internal.clj:249)
	at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:973)
	at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:972)
	at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:977)
	at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:975)
	at clojure.core.async$ioc_alts_BANG_$fn__11920.invoke(async.clj:384)
	at clojure.core.async$do_alts$fn__11860$fn__11863.invoke(async.clj:253)
	at clojure.core.async.impl.channels.ManyToManyChannel$fn__6540.invoke(channels.clj:135)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2022-01-22T08:29:38.569+01:00 INFO  [async-dispatch-3] [p.t.s.w.jetty9-service] Shutting down web server(s).
2022-01-22T08:29:38.575+01:00 INFO  [async-dispatch-3] [p.t.s.s.scheduler-service] Shutting down Scheduler Service
2022-01-22T08:29:38.576+01:00 INFO  [clojure-agent-send-off-pool-0] [o.q.c.QuartzScheduler] Scheduler 54393f5c-476a-44d9-93d3-78ba509e68eb_$_NON_CLUSTERED shutting down.
2022-01-22T08:29:38.576+01:00 INFO  [clojure-agent-send-off-pool-0] [o.q.c.QuartzScheduler] Scheduler 54393f5c-476a-44d9-93d3-78ba509e68eb_$_NON_CLUSTERED paused.
2022-01-22T08:29:38.849+01:00 INFO  [clojure-agent-send-off-pool-0] [o.q.c.QuartzScheduler] Scheduler 54393f5c-476a-44d9-93d3-78ba509e68eb_$_NON_CLUSTERED shutdown complete.
2022-01-22T08:29:38.849+01:00 INFO  [async-dispatch-3] [p.t.s.s.scheduler-service] Scheduler Service shutdown complete.
2022-01-22T08:29:38.853+01:00 INFO  [main] [p.t.internal] Finished shutdown sequence


Regards,

Andre
Comment 5 Romain Tartière freebsd_committer freebsd_triage 2022-01-22 20:01:21 UTC
Hmm… so the java bits are not part of the package and I think this is what cause the failure:

Caused by: org.jruby.embed.EvalFailedException: (LoadError) no such file to load -- /usr/local/lib/ruby/gems/2.7/gems/psych-4.0.3/lib/psych_jars.

I don't think building and installing java stuff as part of rubygem-psych is a move in the right direction.  Using the version of psych bundled with Ruby / JRuby would avoid this issue if it is possible for you.  Another solution might be to rely on bundler to manage your code dependencies.

Can you elaborate on the tools you are using that parse puppet yaml files and depends on rubygem-psych so that I better understand the problem you are facing and how it can be worked around?
Comment 6 Andre Rikkert de Koe - ARK-ICT 2022-01-24 08:35:32 UTC
(In reply to Romain Tartière from comment #5)

hi Romain,

Thanks for your answer.

It's not a big thing. Downgrading or removing rubygem-psych solved it. I don't really need rubygem-psych on the same server that hosts puppetserver7.

However, discovering the root cause why puppetserver7 didn't start anymore took me a while. I decided to build a fresh freebsd server and started building my puppet site from ports using default port config setting (dialogs). Then I ran into same problem. I think is was rubygem-docbook that is a depency of some ports and depends on rubygem-psych itself.

This PR is just to document that if puppetserver7 is build from the current ports tree, it will not start if current rubygem-psych version is installed too.

Regards,

Andre
Comment 7 Oleg Ginzburg 2023-01-13 17:27:05 UTC
2023-01 update: same with puppetserver7-7.9.3

If i create file manually it solve issue:

cat > /usr/local/lib/ruby/gems/3.0/gems/psych-4.0.6/lib/psych_jars.rb <<EOF
require 'psych/versions'
require 'psych.jar'

require 'jar-dependencies'
require_jar('org.yaml', 'snakeyaml', Psych::DEFAULT_SNAKEYAML_VERSION)
EOF
Comment 8 Oleg Ginzburg 2023-01-20 08:17:11 UTC
(In reply to Oleg Ginzburg from comment #7)
update:

This works around the server startup issue, but does not work as expected:
--
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, undefined method `_native_parse' for #<Psych::Parser:0x23bfa884>
--

Also,  it cannot be installed as embedded/private gem via puppetserver:
--
puppetserver gem install psych
Fetching psych-5.0.2-java.gem
ERROR:  While executing gem ... (NoMethodError)
    undefined method `_native_parse' for #<Psych::Parser:0x62075e3d>
        /usr/local/lib/ruby/gems/3.0/gems/psych-5.0.1/lib/psych/parser.rb:62:in `parse'
        /usr/local/lib/ruby/gems/3.0/gems/psych-5.0.1/lib/psych.rb:455:in `parse_stream'
        /usr/local/lib/ruby/gems/3.0/gems/psych-5.0.1/lib/psych.rb:399:in `parse'
        /usr/local/lib/ruby/gems/3.0/gems/psych-5.0.1/lib/psych.rb:323:in `safe_load'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/safe_yaml.rb:30:in `safe_load'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/package.rb:553:in `block in read_checksums'
        org/jruby/ext/zlib/RubyGzipFile.java:97:in `wrap'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/package.rb:552:in `block in read_checksums'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/package/tar_reader.rb:118:in `seek'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/package.rb:551:in `read_checksums'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/package.rb:611:in `block in verify'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/package/tar_reader.rb:27:in `new'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/package.rb:610:in `block in verify'
        org/jruby/RubyIO.java:1148:in `open'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/package/file_source.rb:29:in `with_read_io'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/package.rb:609:in `verify'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/package.rb:590:in `spec'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/installer.rb:287:in `spec'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/installer.rb:716:in `verify_spec'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/installer.rb:906:in `pre_install_checks'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/installer.rb:302:in `install'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/resolver/specification.rb:104:in `install'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/request_set.rb:194:in `block in install'
        org/jruby/RubyArray.java:1865:in `each'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/request_set.rb:182:in `install'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/commands/install_command.rb:210:in `install_gem'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/commands/install_command.rb:226:in `block in install_gems'
        org/jruby/RubyArray.java:1865:in `each'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/commands/install_command.rb:219:in `install_gems'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/commands/install_command.rb:167:in `execute'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/command.rb:323:in `invoke_with_build_args'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/command_manager.rb:185:in `process_args'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/command_manager.rb:149:in `run'
        /usr/local/lib/ruby/site_ruby/3.0/rubygems/gem_runner.rb:51:in `run'
        /usr/local/share/puppetserver/puppet-server-release.jar!/META-INF/jruby.home/bin/jgem:21:in `<main>'
        org/jruby/RubyKernel.java:1052:in `load'
        /usr/local/share/puppetserver/puppet-server-release.jar!/META-INF/jruby.home/bin/gem:4:in `<main>'
        org/jruby/RubyKernel.java:1052:in `load'
        -e:1:in `<main>'
--

probably related: 
https://github.com/ruby/psych/issues/598
https://github.com/mikel/mail/pull/1522
Comment 9 Oleg Ginzburg 2023-01-20 09:12:35 UTC
Also tried to update rubygem-psych to 5.0.2: 

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268941

not helped: '_native_parse' from libyaml.so still unavailable for puppetserver->rubygem-psych
Comment 10 Oleg Ginzburg 2023-01-20 09:51:16 UTC
Rebuild rubygem-psycho with static flags helps me (as work-arount):
--
--- ext/psych/extconf.rb.orig   2023-01-20 09:06:58 UTC
+++ ext/psych/extconf.rb
@@ -2,9 +2,7 @@
 # frozen_string_literal: true
 require 'mkmf'
 
-if $mswin or $mingw or $cygwin
-  $CPPFLAGS << " -DYAML_DECLARE_STATIC"
-end
+$CPPFLAGS << " -DYAML_DECLARE_STATIC"
 
 yaml_source = with_config("libyaml-source-dir")
 if yaml_source
@@ -21,7 +19,7 @@ if yaml_source
   shared = $enable_shared || !$static
   args = [
     yaml_configure,
-    "--enable-#{shared ? 'shared' : 'static'}",
+    "--enable-static",
     "--host=#{RbConfig::CONFIG['host'].sub(/-unknown-/, '-').sub(/arm64/, 'arm')}",
     "CC=#{RbConfig::CONFIG['CC']}",
     *(["CFLAGS=-w"] if RbConfig::CONFIG["GCC"] == "yes"),
--

+

--
rake compile -- --with-libyaml-source-dir=<path-to>/yaml-0.2.5 -with-static
rake build
--

Now 'puppetserver' and puppet agent work fine for me. 
But I have no idea how to fix it in FreeBSD ports.
Comment 11 Oleg Ginzburg 2023-01-20 10:57:17 UTC
Wrote an instruction that will easily reproduce the problem on a clean environment (for example, new jail container):

https://github.com/olevole/puppet-empty/blob/master/README.md
Comment 12 Rene Ladan freebsd_committer freebsd_triage 2025-05-10 10:33:44 UTC
Note that Puppet 7 reached end-of-life and the port expired today, would this we relevant for Puppet 8 too?
Comment 13 Andre Rikkert de Koe - ARK-ICT 2025-05-18 17:49:32 UTC
To test I installed updated rubygem-psych.
Apparently it is solved in current config with updated portstree :-)

My working config is now:

root@puppetserver:~ # pkg info | grep ^puppet
puppet8-8.10.0                 Configuration management framework written in Ruby
puppetdb-terminus8-8.8.1       PuppetDB storeconfigs backend terminus module
puppetdb8-8.8.1                PuppetDB storeconfigs backend
puppetserver8-8.7.0            Puppet Server running in the JVM
root@puppetserver:~ # pkg info | grep rubygem-psych
rubygem-psych-5.2.3            YAML parser and emitter
root@puppetserver:~ # ruby --version
ruby 3.3.8 (2025-04-09 revision b200bad6cd) [amd64-freebsd14]
root@puppetserver:~ #