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

.chocolateyPending file is being used by another process #1159

Closed
biradrags opened this issue Feb 7, 2017 · 7 comments
Closed

.chocolateyPending file is being used by another process #1159

biradrags opened this issue Feb 7, 2017 · 7 comments

Comments

@biradrags
Copy link

Hello
We use chocolatey to install many custom packages remotely using Ansible

What You Are Seeing?

When I run the installation locally on the server, installation is correct.
However, if I run the installation remotely through the ansible installation has an error

What is Expected?

Remote installation must take place correctly

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

When i install package locally on server using command
choco install ibm_integration_bus -dyv - I has successfull installation
Here is logfile:
https://gist.github.com/biradrags/20fffa07319da3495ffdb7112a3cd2b4
But when I try to install package remotely, using Ansible or PowerShell, I get an error when chocolatey trying to remove .chocolateyPending file
https://gist.github.com/biradrags/a413afa6f8987d7779bca9441ed0fc72

Output Log

Chocolatey.log:

2017-02-06 15:33:30,559 [DEBUG] - Finishing 'Start-ChocolateyProcessAsAdmin'
2017-02-06 15:33:30,559 [INFO ] - ibm_integration_bus has been installed.
2017-02-06 15:33:30,574 [DEBUG] - Built-in PowerShell host called with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'D:\Programs/chocolatey\helpers\chocolateyInstaller.psm1'; & 'D:\Programs/chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'D:\Programs/chocolatey\lib\ibm_integration_bus\tools\chocolateyinstall.ps1' -installArguments '' -packageParameters '''] exited with '0'.
2017-02-06 15:33:30,574 [DEBUG] - Calling command ['"C:\windows\System32\shutdown.exe" /a']
2017-02-06 15:33:30,637 [DEBUG] - Command ['"C:\windows\System32\shutdown.exe" /a'] exited with '1116'
2017-02-06 15:33:30,840 [DEBUG] - Capturing package files in 'D:\Programs/chocolatey\lib\ibm_integration_bus'
2017-02-06 15:33:30,887 [ERROR] - ibm_integration_bus not installed. An error occurred during installation:
 Exception of type 'System.OutOfMemoryException' was thrown.
2017-02-06 15:33:30,902 [ERROR] - The process cannot access the file 'D:\Programs\chocolatey\lib\ibm_integration_bus\.chocolateyPending' because it is being used by another process.
2017-02-06 15:33:30,902 [DEBUG] - Exiting with 1

I also recorded the log file handling to .chocolateypending file using procmon.exe:

"Time of Day","Process Name","PID","Operation","Path","Result","Detail"
"15:28:41.6341588","choco.exe","1060","QueryOpen","D:\Programs\chocolatey\lib\ibm_integration_bus\.chocolateyPending","NAME NOT FOUND",""
"15:28:41.6351615","choco.exe","1060","CreateFile","D:\Programs\chocolatey\lib\ibm_integration_bus\.chocolateyPending","SUCCESS","Desired Access: Generic Write, Read Attributes, Disposition: OpenIf, Options: Synchronous IO Non-Alert, Non-Directory File, Open No Recall, Attributes: n/a, ShareMode: Read, AllocationSize: 0, OpenResult: Created"
"15:28:41.6357724","choco.exe","1060","WriteFile","D:\Programs\chocolatey\lib\ibm_integration_bus\.chocolateyPending","SUCCESS","Offset: 0, Length: 22, Priority: Normal"
"15:28:41.6358496","choco.exe","1060","CloseFile","D:\Programs\chocolatey\lib\ibm_integration_bus\.chocolateyPending","SUCCESS",""
"15:28:41.6364065","choco.exe","1060","CreateFile","D:\Programs\chocolatey\lib\ibm_integration_bus\.chocolateyPending","SUCCESS","Desired Access: Generic Read/Write, Disposition: OpenIf, Options: Synchronous IO Non-Alert, Non-Directory File, Open No Recall, Attributes: n/a, ShareMode: None, AllocationSize: 0, OpenResult: Opened"
"15:33:30.7626508","choco.exe","1060","QueryOpen","D:\Programs\chocolatey\lib\ibm_integration_bus\.chocolateyPending","SUCCESS","CreationTime: 06.02.2017 15:28:41, LastAccessTime: 06.02.2017 15:28:41, LastWriteTime: 06.02.2017 15:28:41, ChangeTime: 06.02.2017 15:28:41, AllocationSize: 24, EndOfFile: 22, FileAttributes: A"
"15:33:30.8814743","choco.exe","1060","QueryOpen","D:\Programs\chocolatey\lib\ibm_integration_bus\.chocolateyPending","SUCCESS","CreationTime: 06.02.2017 15:28:41, LastAccessTime: 06.02.2017 15:28:41, LastWriteTime: 06.02.2017 15:28:41, ChangeTime: 06.02.2017 15:28:41, AllocationSize: 24, EndOfFile: 22, FileAttributes: A"
"15:33:30.8815664","choco.exe","1060","CreateFile","D:\Programs\chocolatey\lib\ibm_integration_bus\.chocolateyPending","SHARING VIOLATION","Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Open No Recall, Attributes: n/a, ShareMode: Read, Write, AllocationSize: n/a"
"15:33:30.9181626","choco.exe","1060","CloseFile","D:\Programs\chocolatey\lib\ibm_integration_bus\.chocolateyPending","SUCCESS",""
@ferventcoder
Copy link
Member

It feels like you have two Chocolatey's running. That is usually the case when you see an error such as this.

@ferventcoder
Copy link
Member

However the error of not being able to access the file is likely not the actual error, it's just a warning that is shown. Usually it won't break the process.

From what I see here, it looks like you should increase your WinRM memory. It's too low to handle an install. I would suggest at least 800MB.

@ferventcoder
Copy link
Member

It's the OutOfMemory exception that led me to this conclusion - https://gist.github.com/biradrags/a413afa6f8987d7779bca9441ed0fc72#file-chocolatey-log-L271

@ferventcoder
Copy link
Member

Here is how you can do this: #721 (comment)

1GB is probably not a bad idea.

@ferventcoder
Copy link
Member

@biradrags let me know if that resolves your issue. Thanks!

@biradrags
Copy link
Author

@ferventcoder thank you so much!!!
I changed the config winrm and it worked
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="2048"}'

@ferventcoder
Copy link
Member

Happy to assist.

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

No branches or pull requests

2 participants