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

Bundle_extraction_is_reused intermittently fails with "text file is busy" #44657

Closed
runfoapp bot opened this issue Nov 13, 2020 · 17 comments
Closed

Bundle_extraction_is_reused intermittently fails with "text file is busy" #44657

runfoapp bot opened this issue Nov 13, 2020 · 17 comments
Assignees

Comments

@runfoapp
Copy link

runfoapp bot commented Nov 13, 2020

Runfo Tracking Issue: Bundle_extraction_is_reused intermittently fails with "text file is busy"

Build Definition Kind Run Name

Build Result Summary

Day Hit Count Week Hit Count Month Hit Count
0 0 0
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Nov 13, 2020
@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost
Copy link

ghost commented Nov 16, 2020

Tagging subscribers to this area: @agocke, @vitek-karas
See info in area-owners.md if you want to be subscribed.

Issue Details
Description:

Runfo Tracking Issue: Bundle_extraction_is_reused intermittently fails with "text file is busy"

Build Definition Kind Run Name
885716 runtime PR 44656 Installer-coreclr-Linux_x64-Release
883403 runtime PR 42972 Installer-coreclr-Linux_x64-Release

Build Result Summary

Day Hit Count Week Hit Count Month Hit Count
1 2 2
Author: runfoapp[bot]
Assignees: -
Labels:

area-Single-File, untriaged

Milestone: -

@jkotas jkotas added the blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' label Dec 6, 2020
@eerhardt
Copy link
Member

eerhardt commented Dec 9, 2020

This failed again here:

https://dev.azure.com/dnceng/public/_build/results?buildId=913629&view=logs&j=488ba465-33f8-5af3-b422-ec6526547df5&t=6c6997ae-4d39-5a90-21e3-089719c051c1&l=525

https://dev.azure.com/dnceng/public/_build/results?buildId=913629&view=ms.vss-test-web.build-test-results-tab&runId=29085272&resultId=100002&paneView=debug

Error message
System.ComponentModel.Win32Exception : Text file busy


Stack trace
   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Microsoft.DotNet.Cli.Build.Framework.Command.Start() in /_/src/installer/tests/TestUtils/Command.cs:line 199
   at Microsoft.DotNet.Cli.Build.Framework.Command.Execute(Boolean fExpectedToFail) in /_/src/installer/tests/TestUtils/Command.cs:line 239
   at Microsoft.DotNet.Cli.Build.Framework.Command.Execute() in /_/src/installer/tests/TestUtils/Command.cs:line 171
   at AppHost.Bundle.Tests.StaticHost.Can_Run_SingleFile_App_With_StatiHost() in /_/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/StaticHost.cs:line 44

@vitek-karas
Copy link
Member

The last thing we do on the executable before we call Process.Start (which fails) is this:

// Memory-mapped write does not updating last write time
RetryUtil.RetryOnIOError(() =>
File.SetLastWriteTimeUtc(appHostPath, DateTime.UtcNow));

The Retry has logic to try 500 times (with a short sleep) and if it still fails - then throw. So unless something is really weird, then the SetLastWriteTimeUtc actually succeeded before it's done.

I don't know Linux file system enough to be able to tell if the SetLastWriteTime even requires the file to be "non-busy" - if it can work on "busy" files, then the one we call which actually modifies the content of the file is this:

using (var mappedFile = MemoryMappedFile.CreateFromFile(filePath))
{
using (var accessor = mappedFile.CreateViewAccessor())
{
SearchAndReplace(accessor, searchPattern, patternToReplace, pad0s);
}
}

This has usings around the right stuff - so it should close the file once it's done.

@agocke
Copy link
Member

agocke commented Dec 11, 2020

I think some more info would be helpful. I'm going to try to run strace and get the syscall log to see if I can figure out what's going on under the hood here.

We'll also need to move this entire test into staging unfortunately -- it's too noisy to continue running in all PRs.

agocke added a commit to agocke/runtime that referenced this issue Dec 11, 2020
There is a race condition somewhere in these tests which is causing dotnet#44657
safern added a commit that referenced this issue Dec 22, 2020
* Disable apphost tests on Linux

There is a race condition somewhere in these tests which is causing #44657

* Run disabled tests on staging pipeline

* Fix yml indentation

* Use continue on error on installer tests run

* Pass down restore as well

* Publish test results in global-build-job

* Remove not needed parameter

Co-authored-by: Santiago Fernandez Madero <[email protected]>
@directhex
Copy link
Contributor

Closing, fixed by #45976

@safern
Copy link
Member

safern commented Mar 3, 2021

I don't know if @agocke once to bring those tests back from the staging pipeline to the main one?

@agocke
Copy link
Member

agocke commented Mar 3, 2021

Yeah, let's keep it open. I do eventually want to get to the bottom of this.

@agocke agocke reopened this Mar 3, 2021
@safern safern removed blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' untriaged New issue has not been triaged by the area owner labels Mar 3, 2021
@safern safern added this to the 6.0.0 milestone Mar 3, 2021
@runfoapp runfoapp bot removed this from the 6.0.0 milestone Apr 6, 2021
@runfoapp runfoapp bot closed this as completed Apr 6, 2021
@safern safern reopened this Apr 6, 2021
@safern
Copy link
Member

safern commented Apr 6, 2021

Reopening as this is on the runtime-staging pipeline.

@VincentBu
Copy link
Contributor

Failed in runtime 20210523.14

Failed test:

Installer-coreclr-Linux_x64-Release

- AppHost.Bundle.Tests.BundleExtractToSpecificPath.Bundle_Extraction_To_Relative_Path_Succeeds(relativePath: \"foo/bar\", bundleOptions: BundleAllContent)

Error message:

System.ComponentModel.Win32Exception : Text file busy


Stack trace
   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Microsoft.DotNet.Cli.Build.Framework.Command.Start() in /_/src/installer/tests/TestUtils/Command.cs:line 199
   at Microsoft.DotNet.Cli.Build.Framework.Command.Execute(Boolean fExpectedToFail) in /_/src/installer/tests/TestUtils/Command.cs:line 239
   at Microsoft.DotNet.Cli.Build.Framework.Command.Execute() in /_/src/installer/tests/TestUtils/Command.cs:line 171
   at AppHost.Bundle.Tests.BundleExtractToSpecificPath.Bundle_Extraction_To_Relative_Path_Succeeds(String relativePath, BundleOptions bundleOptions) in /_/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/BundleExtractToSpecificPath.cs:line 87

@VincentBu
Copy link
Contributor

Failed again in runtime 20210602.73

Failed test:

Installer-coreclr-Linux_x64-Release

- AppHost.Bundle.Tests.BundleExtractToSpecificPath.Bundle_Extraction_To_Relative_Path_Succeeds(relativePath: \"./foo\", bundleOptions: BundleAllContent)

Error message:

System.ComponentModel.Win32Exception : Text file busy


Stack trace
   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Microsoft.DotNet.Cli.Build.Framework.Command.Start() in /_/src/installer/tests/TestUtils/Command.cs:line 199
   at Microsoft.DotNet.Cli.Build.Framework.Command.Execute(Boolean fExpectedToFail) in /_/src/installer/tests/TestUtils/Command.cs:line 239
   at Microsoft.DotNet.Cli.Build.Framework.Command.Execute() in /_/src/installer/tests/TestUtils/Command.cs:line 171
   at AppHost.Bundle.Tests.BundleExtractToSpecificPath.Bundle_Extraction_To_Relative_Path_Succeeds(String relativePath, BundleOptions bundleOptions) in /_/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/BundleExtractToSpecificPath.cs:line 87

@danmoseley
Copy link
Member

@agocke we seem to be continuing to hit this (I think there is another issue as well)

@agocke
Copy link
Member

agocke commented Jun 3, 2021

We moved the original stuff to the staging branch, must have missed it on alpine. @VSadov is seeing if he can succeed where I failed -- if we don't have any ideas we can move this one to staging as well.

@agocke
Copy link
Member

agocke commented Aug 30, 2021

Duplicate of #53587

@agocke agocke marked this as a duplicate of #53587 Aug 30, 2021
@agocke agocke closed this as completed Aug 30, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Sep 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

12 participants