summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKartik Null Cating-Subramanian <ksubramanian@chef.io>2017-10-06 11:59:15 -0400
committerKartik Null Cating-Subramanian <ksubramanian@chef.io>2017-10-06 11:59:51 -0400
commitfdf8e17abf9a0c114e3f6657968dd47548b819b7 (patch)
tree9cba3c2a3d7b1d81e4eee7253655cef2a68d5c33
parent842193821084a5487d033f637aec7ff4d8720687 (diff)
downloadchef-fdf8e17abf9a0c114e3f6657968dd47548b819b7.tar.gz
Don't spin in powershell module that launches chef processesksubrama/SUSTAIN-731
Signed-off-by: Kartik Null Cating-Subramanian <ksubramanian@chef.io>
-rw-r--r--distro/powershell/chef/chef.psm125
-rw-r--r--omnibus/.kitchen.yml23
2 files changed, 38 insertions, 10 deletions
diff --git a/distro/powershell/chef/chef.psm1 b/distro/powershell/chef/chef.psm1
index 9196d62e6c..1a5e2cc5eb 100644
--- a/distro/powershell/chef/chef.psm1
+++ b/distro/powershell/chef/chef.psm1
@@ -282,6 +282,24 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) {
break
}
}
+ } else {
+ # For some reason, you can't read from the read-end of the read-pipe before the write end has started
+ # to write. Otherwise the process just blocks forever and never returns from the read. So we peek
+ # at the pipe until there is something. But don't peek too eagerly. This is stupid stupid stupid.
+ # There must be a way to do this without having to peek at a pipe first but I have not found it.
+ #
+ # Note to the future intrepid soul who wants to fix this:
+ # 0) This is related to unreasonable CPU usage by the wrapper PS script on a 1 VCPU VM (either Hyper-V
+ # or VirtualBox) running a consumer Windows SKU (Windows 10 for example...). Test it there.
+ # 1) Maybe this entire script is unnecessary and the bugs mentioned below have been fixed or don't need
+ # to be supported.
+ # 2) The server and consumer windows schedulers have different defaults. I had a hard time reproducing
+ # any issue on a win 2008 on win 2012 server default setup. See the "foreground application scheduler
+ # priority" setting to see if it's relevant.
+ # 3) This entire endeavor is silly anyway - why are we reimplementing process forking all over? Maybe try
+ # to get the folks above to accept patches instead of extending this crazy script.
+ Start-Sleep -s 1
+ # Start-Sleep -m 100
}
if ($global:LASTEXITCODE -ne [Chef.Kernel32]::STILL_ACTIVE) {
@@ -434,9 +452,12 @@ Export-ModuleMember -function chef-solo
Export-ModuleMember -function chef-windows-service
Export-ModuleMember -function knife
-# To debug this module, uncomment the line below and then run the following.
+# To debug this module, uncomment the line below
# Export-ModuleMember -function Run-RubyCommand
+
+# Then run the following to reload the module. Use puts_argv as a helpful debug executable.
# Remove-Module chef
# Import-Module chef
-# "puts ARGV" | Out-File C:\opscode\chef\bin\puts_args
+# "puts ARGV" | Out-File C:\opscode\chef\bin\puts_args -Encoding ASCII
+# Copy-Item C:\opscode\chef\bin\ohai.bat C:\opscode\chef\bin\puts_args.bat
# Run-RubyCommand puts_args 'Here' "are" some '"very interesting"' 'arguments[to]' "`"try out`""
diff --git a/omnibus/.kitchen.yml b/omnibus/.kitchen.yml
index a14d3498de..7042684836 100644
--- a/omnibus/.kitchen.yml
+++ b/omnibus/.kitchen.yml
@@ -73,6 +73,8 @@ platforms:
#
# KITCHEN_LOCAL_YAML=.kitchen.vmware.yml kitchen converge chefdk-macosx-109
#
+
+ # OSX
<% %w(
10.9
10.10
@@ -86,9 +88,15 @@ platforms:
- ['../../omnibus', '/Users/vagrant/omnibus']
- ['../../omnibus-software', '/Users/vagrant/omnibus-software']
<% end %>
- - name: windows-2012r2-standard
+
+ <% %w(
+ 10-enterprise
+ server-2012r2-standard
+ ).each do |win_version| %>
+ # Windows 64-bit
+ - name: windows-<%= win_version %>
driver:
- box: chef/windows-server-2012r2-standard # private
+ box: chef/windows-<%= win_version %> # private
synced_folders:
# We have to mount this repos enclosing folder as the Omnibus build
# gets cranky if the mounted Chef source folder is a symlink. This
@@ -102,16 +110,14 @@ platforms:
build_user_group: Administrators
build_user_password: vagrant
chef_omnibus_root: /opscode/angrychef
+
+ # Windows 32-bit
# By adding an `i386` to the name the Omnibus cookbook's `load-omnibus-toolchain.bat`
# will load the 32-bit version of the MinGW toolchain.
- - name: windows-2012r2-standard-i386
+ - name: windows-<%= win_version %>-i386
driver:
- box: chef/windows-server-2012r2-standard # private
+ box: chef/windows-<%= win_version %> # private
synced_folders:
- # We have to mount this repos enclosing folder as the Omnibus build
- # gets cranky if the mounted ChefDK source folder is a symlink. This
- # mounts at `C:\vagrant\code` and the ChefDK source folder is available
- # at `C:\vagrant\code\chef-dk`
- ['../..', '/vagrant/code']
provisioner:
attributes:
@@ -120,6 +126,7 @@ platforms:
build_user_group: Administrators
build_user_password: vagrant
chef_omnibus_root: /opscode/angrychef
+ <% end %>
suites:
# - name: angrychef