Skip to content

Commit

Permalink
(PUP-724,#21922) Autoload compares only integer secs
Browse files Browse the repository at this point in the history
Although the ultimate reasons have not been tracked down, there have
been occasions where the Puppet::Util::Autoload.changed? method will
erroneously report that a file has changed based on an mtime having
seemed to change nsecs, despite no evidence of this being seen in the
file system.

The previous implementation was comparing mtime (Ruby Time instances)
and the nsecs seem to be volatile under unknown conditions. When it does
break, this was manifesting as a failure to autoload
puppet/util/instrumentation/listeners/log.rb (the instrumentation code
is relying on Puppet::Util::Autoload for initial loading but does not
expect its listeners to be reloaded, and they are not written in such a
way as to be reloadable...) (see PUP-724 and its associated tickets for
details).

The work around is to instead just compare integer secs.
  • Loading branch information
jpartlow committed Jan 3, 2014
1 parent ef2f741 commit 1004eae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet/util/autoload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def changed?(name)
file, old_mtime = loaded[name]
return true unless file == get_file(name)
begin
old_mtime != File.mtime(file)
old_mtime.to_i != File.mtime(file).to_i
rescue Errno::ENOENT
true
end
Expand Down

0 comments on commit 1004eae

Please sign in to comment.