Open erikng opened 5 years ago
I think I might have found the culprit and it is the hostname plugin
[2019-04-22T09:20:15-07:00] TRACE: Plugin Hostname: ran 'hostname -s' and returned 0
[2019-04-22T09:20:15-07:00] TRACE: Plugin Hostname: ran 'hostname' and returned 0
[2019-04-22T09:20:15-07:00] TRACE: Plugin Hostname: ran 'hostname' and returned 0
[2019-04-22T09:20:45-07:00] TRACE: Plugin Hostname: hostname returned an empty string, retrying once.
[2019-04-22T09:20:45-07:00] TRACE: Plugin Hostname: ran 'hostname' and returned 0
[2019-04-22T09:21:15-07:00] TRACE: Plugin Hostname: hostname returned an empty string twice and willnot be set.
[2019-04-22T09:21:15-07:00] TRACE: Plugin Hostname took 0.02318400000000015 seconds to run.
Looks like it's this function: https://github.com/chef/ohai/blob/master/lib/ohai/plugins/hostname.rb#L47-L56
Perhaps this should have a timeout of 1-2 seconds?
vagrant-18E226:~ vagrant$ sudo scutil --get HostName
vagrant-VM-564D8F6B
vagrant-18E226:~ vagrant$ sudo scutil --set HostName vagrant-VM-564D8F6B.test
vagrant-18E226:~ vagrant$ sudo scutil --get HostName
vagrant-VM-564D8F6B.test
so if I set the HostName (macs have ComputerName, LocalHostName and HostName) it instantly fixes the issue. These values may not be set by the user, so you definitely should write around this not existing.
Description
When trying to run ohai under a macOS VM running VMware Fusion, it is extremely slow. This makes tools like
kitchen converge
andchef-client
take several minutes when it should be just a few seconds during cookbook testing.I have disabled a lot of plugins that are known to cause issues on macOS
ohai.disabled_plugins = [:Azure, :Cloud, :Cloudstack, :CloudV2, :EC2, :Eucalyptus, :GCE, :Joyent, :Linode, :Mdadm, :Openstack, :Passwd, :Rackspace, :Zpools]
Unfortunately ohai still takes over 60 seconds per run to finish.
Interestingly enough, once I bound this VM to an Active Directory domain, it's instantly faster.
I'm hoping you can lead me to the plugin that is having the issue.
Ohai Version
Ohai: 14.8.11
Platform Version