Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple bash deployment script hangs #2041

Closed
davidebbo opened this issue Jun 11, 2016 · 6 comments
Closed

Simple bash deployment script hangs #2041

davidebbo opened this issue Jun 11, 2016 · 6 comments

Comments

@davidebbo
Copy link
Member

davidebbo commented Jun 11, 2016

Issue comes from http://stackoverflow.com/questions/37739407/azure-web-site-kudu-publishing-failing-with-timeout/37740335.

This seems to have regressed with the new git 2.8.x. The repro is quite trivial. Here is a repo: https://github.com/KuduApps/KuduDeployBash

It just has two files. .deployment has:

[config]
command = deploy.sh

And deploy.sh has:

#!/bin/bash
echo "Hello"

Which push to Kudu, it hangs trying to launch the script.

@davidebbo
Copy link
Member Author

davidebbo commented Jun 11, 2016

Here is the process stack. mintty.exe is spinning non-stop with high CPU.

image

And the command line of the 3 top processes:

cmd.exe: D:\Windows\system32\cmd.exe /c ""C:\Program Files (x86)\SiteExtensions\Kudu\55.50610.2267\bin\Scripts\starter.cmd" deploy.sh"
git-bash.exe: "D:\Program Files (x86)\Git\git-bash.exe" --no-cd "D:\home\site\repository\deploy.sh"
mintty.exe: usr\bin\mintty.exe -o AppID=GitForWindows.Bash -o RelaunchCommand="D:\Program Files (x86)\Git\git-bash.exe" -o RelaunchDisplayName="Git Bash" -i /mingw32/share/git/git-for-windows.ico /usr/bin/bash --login -i "D:\home\site\repository\deploy.sh"

@davidebbo
Copy link
Member Author

The simplest repro is to just run deploy.sh from Kudu console, which hangs in the same way.

This triggers the .sh extension handler. HKEY_CLASSES_ROOT\sh_auto_file\shell\open\command maps to "D:\Program Files (x86)\Git\git-bash.exe" --no-cd "%L" %*, which is why would end up launching git-bash.exe.

Note that running bash deploy.sh from the command line works fine.

@davidebbo
Copy link
Member Author

I found that if I change the shell reg key to "D:\Program Files (x86)\Git\bin\bash.exe" --no-cd "%L" %*, the issue doesn't happen.

@dscho can you explain the difference between git-bash.exe and bash.exe? Why does one use mintty but not the other?

@dscho
Copy link

dscho commented Jun 12, 2016

@davidebbo git-bash.exe is supposed to run a graphical terminal, set up the environment variables appropriately, and then call the real Bash. bin/bash.exe does the same, but without the graphical shell (it is a console program). So it looks like you found the correct solution.

@davidebbo
Copy link
Member Author

Instead of hacking the registry, a simpler change is to run the script shell explicitly instead of relying on Windows shell.

e.g. in .deployment file, instead of:

[config]
command = deploy.sh

We should have:

[config]
command = bash deploy.sh

Users who already generated this file will need to change it, but we should change our KuduScript generator to do it.

@davidebbo
Copy link
Member Author

It turns out that our generator already does the right thing. So only users hitting this probably hand won't their .deployment file, and can easily change that.

So I don't think we need to fix anything here.

andrewmyhre added a commit to andrewmyhre/IndulgeMe that referenced this issue Aug 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants