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

Task [Publish_GitHub_Wiki_Content] hangs when it creates a large commit #111

Open
ykuijs opened this issue Jan 26, 2022 · 0 comments
Open
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@ykuijs
Copy link
Member

ykuijs commented Jan 26, 2022

Details of the scenario you tried and the problem that is occurring

When the task "Publish_GitHub_Wiki_Content" implements a lot of changes which results in a large commit, it is possible that the call to the "git commit" hangs, which is causing a time-out and an error message:

This call:

Invoke-Git -WorkingDirectory $tempPath `
-Arguments @( 'commit', '--message', "`"$($localizedData.UpdateWikiCommitMessage -f $ModuleVersion)`"" )

Hangs here:

if ($process.WaitForExit($TimeOut) -eq $true)

Troubleshooting revealed that a call to $process.StandardOutput.ReadToEnd() immediately after the call to WaitForExit unfreezes the process and causes it to complete successfully.

Steps to reproduce the problem

Start with an empty wiki repo and generate a large number of markdown files. The code will run into the two minute timeout and then throw an error about not being able to remove the temp folder.

Expected behavior

Create a successful commit

Current behavior

Throw an error message:

ERROR: Cannot remove the item at 'C:\Users\USER\AppData\Local\Temp\o3k3fxk0.hkt' because it is in use.
At C:\src\MODULE\output\RequiredModules\DscResource.DocGenerator\0.10.2\DscResource.DocGenerator.psm1:3440 char:9
+         Remove-Item -Path $tempPath -Recurse -Force
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At C:\src\MODULE\output\RequiredModules\DscResource.DocGenerator\0.10.2\tasks\Publish_GitHub_Wiki_Content.build.ps1:102 char:1
+ task Publish_GitHub_Wiki_Content {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Suggested solution to the issue

This issue is most probably caused by the fact that the git commit command generates a lot of data to the output stream, which is causing the buffer to become full and the git process to hang.....waiting until the buffer is emptied, so it can continue. Solution is to read the output buffer during the process, clearing the buffer so new messages can be added to the buffer.

More information can be found here:

The operating system the target node is running

Windows 11

Version and build of PowerShell the target node is running

v5.1

Version of the module that was used

v0.10.2

@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants