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

[Flaky test] Microsoft.Build.UnitTests.Exec_Tests.Timeout #9176

Closed
JaynieBai opened this issue Aug 28, 2023 · 7 comments · Fixed by #11499
Closed

[Flaky test] Microsoft.Build.UnitTests.Exec_Tests.Timeout #9176

JaynieBai opened this issue Aug 28, 2023 · 7 comments · Fixed by #11499
Assignees
Labels
Area: Our Own Build Problems affecting the build or build infrastructure of the MSBuild repo itself. needs-investigation

Comments

@JaynieBai
Copy link
Member

Microsoft.Build.UnitTests.Exec_Tests.Timeout

Details

https://dev.azure.com/dnceng-public/public/_build/results?buildId=385968&view=ms.vss-test-web.build-test-results-tab&runId=8250290&resultId=105001&paneView=history

https://dev.azure.com/dnceng-public/public/_build/results?buildId=385824&view=ms.vss-test-web.build-test-results-tab&runId=8245228&resultId=104901

Assert.Equal() Failure\r\nExpected: 1\r\nActual: 2

at Microsoft.Build.UnitTests.Exec_Tests.Timeout() in D:\a\_work\1\s\src\Tasks.UnitTests\Exec_Tests.cs:line 133

@JaynieBai JaynieBai added the Area: Our Own Build Problems affecting the build or build infrastructure of the MSBuild repo itself. label Aug 28, 2023
@JaynieBai JaynieBai self-assigned this Aug 28, 2023
@rainersigwald
Copy link
Member

WARNING MSB5018: Failed to delete the temporary file "C:\Users\cloudtest\AppData\Local\Temp\wjicfzi0.4pf\MSBuildTempcloudtest\tmp141ec17b96ed46fbbe9a45ffeade2592.exec.cmd". Access to the path 'C:\Users\cloudtest\AppData\Local\Temp\wjicfzi0.4pf\MSBuildTempcloudtest\tmp141ec17b96ed46fbbe9a45ffeade2592.exec.cmd' is denied.

Is an interesting symptom that I certainly don't understand immediately.

@JaynieBai
Copy link
Member Author

WARNING MSB5018: Failed to delete the temporary file "C:\Users\cloudtest\AppData\Local\Temp\wjicfzi0.4pf\MSBuildTempcloudtest\tmp141ec17b96ed46fbbe9a45ffeade2592.exec.cmd". Access to the path 'C:\Users\cloudtest\AppData\Local\Temp\wjicfzi0.4pf\MSBuildTempcloudtest\tmp141ec17b96ed46fbbe9a45ffeade2592.exec.cmd' is denied.

Is an interesting symptom that I certainly don't understand immediately.

@rainersigwald Where did you find another warning?

@JaynieBai JaynieBai removed their assignment Sep 6, 2023
@JaynieBai
Copy link
Member Author

JaynieBai commented Sep 18, 2023

WARNING MSB5018: Failed to delete the temporary file "C:\Users\cloudtest\AppData\Local\Temp\wjicfzi0.4pf\MSBuildTempcloudtest\tmp141ec17b96ed46fbbe9a45ffeade2592.exec.cmd". Access to the path 'C:\Users\cloudtest\AppData\Local\Temp\wjicfzi0.4pf\MSBuildTempcloudtest\tmp141ec17b96ed46fbbe9a45ffeade2592.exec.cmd' is denied.

Is an interesting symptom that I certainly don't understand immediately.

@rainersigwald Where did you find another warning?

Find the log in the attachments.
https://dev.azure.com/dnceng-public/public/_build/results?buildId=405969&view=ms.vss-test-web.build-test-results-tab&runId=8806674&resultId=105005&paneView=attachments

The file is created when _batchFile = FileUtilities.GetTemporaryFileName(".exec.cmd");

Throw the exception when

{
File.Delete(fileName);
}
catch (Exception e) when (ExceptionHandling.IsIoRelatedException(e))
{
// Warn only -- occasionally temp files fail to delete because of virus checkers; we
// don't want the build to fail in such cases
LogShared.LogWarningWithCodeFromResources("Shared.FailedDeletingTempFile", fileName, e.Message);
}

@JaynieBai
Copy link
Member Author

JaynieBai commented Oct 31, 2023

Throw the exception in the following code. But couldn't find a way to know which process makes the file not be deleted until now

{
File.Delete(fileName);
}
catch (Exception e) when (ExceptionHandling.IsIoRelatedException(e))
{
// Warn only -- occasionally temp files fail to delete because of virus checkers; we
// don't want the build to fail in such cases
LogShared.LogWarningWithCodeFromResources("Shared.FailedDeletingTempFile", fileName, e.Message);
}

@YuliiaKovalova
Copy link
Member

YuliiaKovalova commented Mar 6, 2024

Please extend the logging/consider warning suppression for this test and close the ticket.

JaynieBai added a commit that referenced this issue Jan 6, 2025
…c_Tests.Timeout (#9386)

Add more processes Logs for failed case Microsoft.Build.UnitTests.Exec_Tests.Timeout
To understand why the warning #9176 (comment) occurs
@JaynieBai
Copy link
Member Author

JaynieBai commented Feb 7, 2025

This commit d7788d6#diff-3abd8382aac3bdfa59d5c1ca41dd089795d6ca539a00b3c50eab4fd6a0996314 including string lockedFileMessage = LockCheck.GetLockedFileMessage(fileName); doesn't include the block process info in the new run https://dev.azure.com/dnceng-public/public/_build/results?buildId=933070&view=ms.vss-test-web.build-test-results-tab&runId=24707220&resultId=105105&paneView=debug

Shouldly.ShouldAssertException : warningsCount\r\n should be\r\n1\r\n but was\r\n2\r\n\r\nAdditional Info:\r\n Expected 1 warning, encountered 2: Terminating the task executable "cmd" because it did not finish within the specified limit of 5 milliseconds.,Failed to delete the temporary file "C:\Users\cloudtest\AppData\Local\Temp\kdgi3310.yrd\MSBuildTemp\tmp0b07b143716145d5940700444ff44098.exec.cmd". Access to the path 'C:\Users\cloudtest\AppData\Local\Temp\kdgi3310.yrd\MSBuildTemp\tmp0b07b143716145d5940700444ff44098.exec.cmd' is denied.

JaynieBai added a commit that referenced this issue Mar 12, 2025
Fixes #9176

Context
Occasionally temp files fail to delete because of virus checkers, so generate MSB5018 warning.
The commit d7788d6#diff-3abd8382aac3bdfa59d5c1ca41dd089795d6ca539a00b3c50eab4fd6a0996314 including string lockedFileMessage = LockCheck.GetLockedFileMessage(fileName); doesn't output the related process.

Changes Made
Add the warning MSB5018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Our Own Build Problems affecting the build or build infrastructure of the MSBuild repo itself. needs-investigation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants