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

Wait for child processes to complete (if parent process exited early) #725

Open
dekalinowski opened this issue May 6, 2016 · 9 comments · May be fixed by #726
Open

Wait for child processes to complete (if parent process exited early) #725

dekalinowski opened this issue May 6, 2016 · 9 comments · May be fixed by #726

Comments

@dekalinowski
Copy link

I made a fix for the below... Will make a pull-request for review in a moment.

What You Are Seeing?

Install-ChocolateyInstallPackage & Start-ChocolateyProcessAsAdmin exited prematurely during one of my installation packages (an privately maintained MATLAB installer). This causes unexpected behavior since:

  1. Chocolatey will not receive any meaningful exit-code from the installer
  2. Subsequent package installations which depend on this will fail due to a partial installation

Upon investigation, I discovered the installer process exited immediately, however, the installer continued installation tasks as independent child processes.

What is Expected?

The Start-ChocolateyProcessAsAdmin must look for child processes to the installation -- and wait for these to complete.

How Did You Get This To Happen? (Steps to Reproduce)

Used "Install-ChocolateyInstallPackage" with MATLAB R2015B setup.exe

Output Log

Nothing helpful to report here.

@ferventcoder
Copy link
Member

Fixes are good. 👍

Please ensure that you review the CONTRIBUTING document (in its entirety, we are very particular, especially with git commit messages) to be sure everything is good and things can be processed faster. https://github.com/chocolatey/choco/blob/master/CONTRIBUTING.md

dekalinowski added a commit to dekalinowski/choco that referenced this issue May 6, 2016
Fix for installers which exit immediately, and spawn lingering child
processes, which may carry on additional installation tasks.

Solution first queries for child processes whose parent process ID
matches the installer process. Then, recursively queries for other
active processes related to those children. Finally, wait for each
process to exit.
@dekalinowski dekalinowski linked a pull request May 6, 2016 that will close this issue
@dekalinowski
Copy link
Author

I first made this improvement on a private branch before #526.

So I am in doubt, but could the changes in #526 have fixed this as well? I.e, was the older implementation not waiting on the correct handle?

@ferventcoder
Copy link
Member

If you run the setup with the 0.9.10 beta, do you still run into this issue? I think it might.

@dekalinowski
Copy link
Author

Would it be easy to install the beta versions for general users? I may wish to use a beta version until an official release with #526 comes.

The changes in #526 seem to solve the underlying issue for me. Based on a quick test where I replaced the Start-ChocolateyProcessAsAdmin.ps1 manually.

The version here exhibits the defect:
https://github.com/chocolatey/choco/blob/0.9.10-beta1/src/chocolatey.resources/helpers/functions/Start-ChocolateyProcessAsAdmin.ps1

Whereas, the version here works perfectly fine:
https://github.com/chocolatey/choco/blob/01db65b0b4e6637694ee2c24477214b0592853b8/src/chocolatey.resources/helpers/functions/Start-ChocolateyProcessAsAdmin.ps1

Consider the issue closed and reject the pull-request, then?

@ferventcoder
Copy link
Member

choco upgrade chocolatey -pre (pretty simple)

@ferventcoder ferventcoder modified the milestones: 0.9.10.1, 0.9.10.2, 0.9.10.3, 0.9.10.4 Jun 17, 2016
@dekalinowski
Copy link
Author

I confirm v0.9.10.2 of Chocolatey resolves this issue. No further action needed.

@ferventcoder ferventcoder removed this from the 0.10.6 milestone Apr 1, 2017
@ferventcoder ferventcoder modified the milestones: 0.10.7, 0.10.8 Jun 6, 2017
@ferventcoder ferventcoder added this to the 0.10.9 milestone Jun 26, 2017
@ferventcoder ferventcoder modified the milestones: 0.10.9, 0.10.10 Aug 29, 2017
@catsburg
Copy link

What's the status of this? I'm running in to the same problem with a custom made package for offline visual studio installation. using choco 0.10.8.

@bcurran3
Copy link

While you're waiting for the actual Chocolatey update, you can easily kludge your internal packages with https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/start-sleep?view=powershell-6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants