Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-11-09 Thread Claire Cadman (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Claire Cadman updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10719  
 
 
  Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
Change By: 
 Claire Cadman  
 
 
Labels: 
 doc_reviewed  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.374990.1602706184000.74515.1604933400040%40Atlassian.JIRA.


Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-11-05 Thread Mihai Buzgau (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mihai Buzgau updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10719  
 
 
  Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
Change By: 
 Mihai Buzgau  
 
 
Fix Version/s: 
 PUP 7.0.0  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.374990.1602706184000.72595.1604566680259%40Atlassian.JIRA.


Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-20 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-10719  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
 Passed CI in 396538b945 (master).   
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.374990.1602706184000.59331.1603226400030%40Atlassian.JIRA.


Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-19 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10719  
 
 
  Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
Change By: 
 Josh Cooper  
 
 
Release Notes: 
 Bug Fix  
 
 
Release Notes Summary: 
 Fixes a rubygems caching issue that could prevent the agent from applying a catalog if a gem is managed using the native package manager, such as yum or apt.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.374990.1602706184000.58532.1603154520028%40Atlassian.JIRA.


Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-19 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-10719  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
 Merged to master in https://github.com/puppetlabs/puppet/commit/396538b945e0f7d6d28cb5e8abd7e7c975536f3b  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.374990.1602706184000.58531.1603154340031%40Atlassian.JIRA.


Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-14 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10719  
 
 
  Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
Change By: 
 Josh Cooper  
 
 
Team: 
 Coremunity  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.374990.1602706184000.56191.1602721500136%40Atlassian.JIRA.


Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-14 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-10719  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
 
 
One option is to call Gem.clear_paths if a feature fails to load.
 That causes a slow down because we end up repeatedly failing and retrying for gems that really aren't there, like msgpack. 
 
Or rescue the exception when calling Gem::Specifications.latest_specs
 That means we're still loading the full gemspec unnecessarily.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.374990.1602706184000.56189.1602721500047%40Atlassian.JIRA.


Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-14 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10719  
 
 
  Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
Change By: 
 Josh Cooper  
 
 
Sprint: 
 Platform Core KANBAN  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.374990.1602706184000.56190.1602721500091%40Atlassian.JIRA.


Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-14 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10719  
 
 
  Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
Change By: 
 Josh Cooper  
 
 
Fix Version/s: 
 PUP 6.20.0  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.374990.1602706184000.56186.1602721320030%40Atlassian.JIRA.


Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-14 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-10719  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
 Interestingly, the feature that enables puppet to load extensions from gems causes the number of file I/O operations to increase by ~2.5 times during catalog compilation using the pupetserver perf control repo. Seems completely unnecessary for the rubygems cache to be cleared during compilation.  
 
 
 
 
 [root@unheeded-statue ~]# strace -e trace=file -o trace.log -- puppet catalog compile -E perf_control  > /dev/null  
 
 
 [root@unheeded-statue ~]# grep /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0 trace.log  | wc -l  
 
 
 13743  
 
 
 [root@unheeded-statue ~]# strace -e trace=file -o trace-nogems.log -- puppet catalog compile -E perf_control  > /dev/null  
 
 
 ...  
 
 
 [root@unheeded-statue ~]# grep /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0 trace-nogems.log | wc -l  
 
 
 5518
  
 
 
 
   
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

   

Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-14 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10719  
 
 
  Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
Change By: 
 Josh Cooper  
 

  
 
 
 
 

 
 If a gem is managed by a native package manager (rpm, etc), and it is updated during a puppet run, it is possible for rubygems to be left in a bad state causing the run to fail.This can be reproduced using:{code:ruby}require 'fileutils'require 'rubygems'if File.exist?("/tmp/thor-1.0.1.gemspec")  FileUtils.mv("/tmp/thor-1.0.1.gemspec", "/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/specifications/thor-1.0.1.gemspec")endGem.clear_pathsbegin  require 'msgpack'rescue LoadError => eendFileUtils.mv("/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/specifications/thor-1.0.1.gemspec", "/tmp/thor-1.0.1.gemspec")Gem::Specification.latest_specs{code}Rubygems monkey patches {{Kernel.require}} so that if the gem fails to load, it will try to activate it. This has the side effect of caching the stub specifications for all gems.If the gemspec is then removed via rpm upgrade, then the cached stub specification will refer to a gemspec that no longer exists.If we later try to load the full specifications (such as when autoloading a terminus), then rubygems will raise:{noformat}/opt/puppetlabs/puppet/lib/ruby/2.5.0/rubygems/specification.rb:743:in `_all': pid: 9272 nil spec! included in [...#...]{noformat} It can also be reproduced in puppet using:{code:ruby}require 'fileutils'require 'puppet' if File.exist?("/tmp/thor-1.0.1.gemspec")  FileUtils.mv("/tmp/thor-1.0.1.gemspec", "/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/specifications/thor-1.0.1.gemspec")end Puppet.initialize_settingsPuppet[:log_level] = 'debug' Puppet.features.msgpack?FileUtils.mv("/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/specifications/thor-1.0.1.gemspec", "/tmp/thor-1.0.1.gemspec")Puppet::FileBucket::File.indirection.terminus(:rest){code}  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 

Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-14 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10719  
 
 
  Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
Change By: 
 Josh Cooper  
 

  
 
 
 
 

 
 If a gem is managed by a native package manager (rpm, etc), and it is updated during a puppet run, it is possible for rubygems to be left in a bad state causing the run to fail.This can be reproduced using:{code:ruby}require 'fileutils'require 'rubygems'  if File.exist?("/tmp/thor-1.0.1.gemspec")  FileUtils.mv("/tmp/thor-1.0.1.gemspec", "/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/specifications/thor-1.0.1.gemspec")endGem.clear_pathsbegin  require 'msgpack'rescue LoadError => eendFileUtils.mv("/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/specifications/thor-1.0.1.gemspec", "/tmp/thor-1.0.1.gemspec")Gem::Specification.latest_specs{code}Rubygems monkey patches {{Kernel.require}} so that if the gem fails to load, it will try to activate it. This has the side effect of caching the stub specifications for all gems.If the gemspec is then removed via rpm upgrade, then the cached stub specification will refer to a gemspec that no longer exists.If we later try to load the full specifications (such as when autoloading a terminus), then rubygems will raise:{noformat}/opt/puppetlabs/puppet/lib/ruby/2.5.0/rubygems/specification.rb:743:in `_all': pid: 9272 nil spec! included in [...#...]{noformat}  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 
 

Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-14 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-10719  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
 One option is to call Gem.clear_paths if a feature fails to load. Or rescue the exception when calling Gem::Specifications.latest_specs, calling Gem.clear_paths and then retry once.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.374990.1602706184000.56049.1602706320025%40Atlassian.JIRA.


Jira (PUP-10719) Puppet's feature detection can leave rubygems in a bad state

2020-10-14 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10719  
 
 
  Puppet's feature detection can leave rubygems in a bad state   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Assignee: 
 Unassigned  
 
 
Created: 
 2020/10/14 1:09 PM  
 
 
Priority: 
  Normal  
 
 
Reporter: 
 Josh Cooper  
 

  
 
 
 
 

 
 If a gem is managed by a native package manager (rpm, etc), and it is updated during a puppet run, it is possible for rubygems to be left in a bad state causing the run to fail. This can be reproduced using:  
 
 
 
 
 require 'fileutils'  
 
 
 require 'rubygems'if File.exist?("/tmp/thor-1.0.1.gemspec")  
 
 
   FileUtils.mv("/tmp/thor-1.0.1.gemspec", "/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/specifications/thor-1.0.1.gemspec")  
 
 
 end  
 
 
 Gem.clear_paths  
 
 
 begin