Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Read_Archive_File failing due to access denied to tar/pax/file.tar #68357

Closed
danmoseley opened this issue Apr 21, 2022 · 7 comments · Fixed by #68361
Closed

Read_Archive_File failing due to access denied to tar/pax/file.tar #68357

danmoseley opened this issue Apr 21, 2022 · 7 comments · Fixed by #68361
Assignees
Labels
area-System.Formats.Tar blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'

Comments

@danmoseley
Copy link
Member

danmoseley commented Apr 21, 2022

❌ System.Formats.Tar.Tests.TarReader_File_Tests.Read_Archive_File [[Details]](https://dev.azure.com/dnceng//public/_build/results?buildId=1731384&view=ms.vss-test-web.build-test-results-tab&runId=46911660&resultId=125928&paneView=debug) [[History]](https://dev.azure.com/dnceng//public/_build/results?buildId=1731384&view=ms.vss-test-web.build-test-results-tab&runId=46911660&resultId=125928&paneView=history) [[Artifacts]](https://dev.azure.com/dnceng//public/_build/results?buildId=1731384&view=ms.vss-test-web.build-test-results-tab&runId=46911660&resultId=125928&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab)
Data Driven SubResults
❌ System.Formats.Tar.Tests.TarReader_File_Tests.Read_Archive_File(format: Pax, testFormat: pax)
Exception Message
System.IO.IOException : The process cannot access the file '/mnt/work/B12709CA/w/BB4B09F1/e/tar/pax/file.tar' because it is being used by another process.
Stack Trace
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Init(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Int64& fileLength, Permissions& filePermissions) in /_/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs:line 448
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Permissions openPermissions, Int64& fileLength, Permissions& filePermissions, Func`4 createOpenException) in /_/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs:line 224
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Permissions openPermissions, Func`4 createOpenException) in /_/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs:line 189
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) in /_/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/OSFileStreamStrategy.cs:line 46
   at System.IO.Strategies.UnixFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) in /_/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/UnixFileStreamStrategy.cs:line 15
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) in /_/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Unix.cs:line 17
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) in /_/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.cs:line 24
   at System.IO.FileStream..ctor(String path, FileStreamOptions options) in /_/src/libraries/System.Private.CoreLib/src/System/IO/FileStream.cs:line 205
   at System.Formats.Tar.Tests.TarTestsBase.GetTarMemoryStream(CompressionMethod compressionMethod, TestTarFormat format, String testCaseName) in /_/src/libraries/System.Formats.Tar/tests/TarTestsBase.cs:line 110
   at System.Formats.Tar.Tests.TarReader_File_Tests.Read_Archive_File(TarFormat format, TestTarFormat testFormat) in /_/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.cs:line 24
   at System.Reflection.RuntimeMethodInfo.InvokeNonEmitUnsafe(Object obj, IntPtr* byrefParameters, Span`1 argsForTemporaryMonoSupport, BindingFlags invokeAttr) in /_/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.Mono.cs:line 397
Pass Rate
Test has failed 16 out of 702 runs (2.28%)
Failing Configuration
net7.0-Linux-Debug-x64-Mono_release-RedHat.7.Amd64.Open

Runfo Tracking Issue: Read_Archive_File failing due to access denied to tar/pax/file.tar

Build Definition Kind Run Name Console Core Dump Test Results Run Client
1731439 runtime PR 67917 net7.0-Linux-Debug-arm-CoreCLR_checked-(Ubuntu.1804.Arm32.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 console.log runclient.py
1731439 runtime PR 67917 net7.0-Linux-Debug-arm-CoreCLR_checked-(Ubuntu.1804.Arm32.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 console.log runclient.py
1731421 runtime PR 67701 net7.0-Linux-Debug-x64-Mono_release-Ubuntu.1804.Amd64.Open console.log runclient.py
1731421 runtime PR 67701 net7.0-Linux-Debug-x64-Mono_release-Ubuntu.1804.Amd64.Open console.log runclient.py
1731421 runtime PR 67701 net7.0-OSX-Debug-x64-Mono_release-OSX.1200.Amd64.Open console.log runclient.py
1731421 runtime PR 67701 net7.0-OSX-Debug-x64-Mono_release-OSX.1200.Amd64.Open console.log runclient.py
1731421 runtime PR 67701 net7.0-Linux-Debug-x64-CoreCLR_release-(Alpine.314.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.14-helix-amd64-20210910135833-1848e19 console.log runclient.py
1731421 runtime PR 67701 net7.0-Linux-Debug-x64-CoreCLR_release-(Alpine.314.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.14-helix-amd64-20210910135833-1848e19 console.log runclient.py
1731384 runtime PR 68346 net7.0-Linux-Debug-x64-Mono_release-RedHat.7.Amd64.Open console.log runclient.py
1731384 runtime PR 68346 net7.0-Linux-Debug-x64-Mono_release-RedHat.7.Amd64.Open console.log runclient.py
1731370 runtime PR 68349 net7.0-Linux-Debug-x64-Mono_release-(Debian.10.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64-20210304164434-56c6673 console.log runclient.py
1731370 runtime PR 68349 net7.0-Linux-Debug-x64-Mono_release-(Debian.10.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64-20210304164434-56c6673 console.log runclient.py
1731369 runtime Rolling net7.0-Linux-Release-arm-CoreCLR_checked-(Ubuntu.1804.Arm32.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 console.log runclient.py
1731369 runtime Rolling net7.0-Linux-Release-arm-CoreCLR_checked-(Ubuntu.1804.Arm32.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 console.log runclient.py
1731321 runtime PR 67258 net7.0-windows-Release-x86-CoreCLR_release-Windows.7.Amd64.Open console.log runclient.py
1731321 runtime PR 67258 net7.0-windows-Release-x86-CoreCLR_release-Windows.7.Amd64.Open console.log runclient.py
1731269 runtime PR 68337 net7.0-Linux-Debug-x64-CoreCLR_release-RedHat.7.Amd64.Open console.log runclient.py
1731269 runtime PR 68337 net7.0-Linux-Debug-x64-CoreCLR_release-RedHat.7.Amd64.Open console.log runclient.py
1731175 runtime PR 68345 net7.0-Linux-Debug-arm64-CoreCLR_checked-(Alpine.314.Arm64.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.14-helix-arm64v8-20210910135810-8a6f4f3 console.log runclient.py
1731175 runtime PR 68345 net7.0-Linux-Debug-arm64-CoreCLR_checked-(Alpine.314.Arm64.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.14-helix-arm64v8-20210910135810-8a6f4f3 console.log runclient.py
1731036 runtime PR 67859 net7.0-OSX-Debug-x64-Mono_release-OSX.1200.Amd64.Open console.log runclient.py
1731036 runtime PR 67859 net7.0-OSX-Debug-x64-Mono_release-OSX.1200.Amd64.Open console.log runclient.py
1730876 runtime PR 68334 net7.0-windows-Debug-x64-CoreCLR_release-Windows.81.Amd64.Open console.log runclient.py
1730876 runtime PR 68334 net7.0-windows-Debug-x64-CoreCLR_release-Windows.81.Amd64.Open console.log runclient.py
1730871 runtime PR 65785 net7.0-Linux-Debug-x64-CoreCLR_release-(Centos.Stream9.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9-helix-20220421130143-dee2d19 console.log runclient.py
1730871 runtime PR 65785 net7.0-Linux-Debug-x64-CoreCLR_release-(Centos.Stream9.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9-helix-20220421130143-dee2d19 console.log runclient.py
1729757 runtime PR 67883 net7.0-windows-Debug-x86-CoreCLR_checked-Windows.10.Amd64.Open console.log runclient.py
1729757 runtime PR 67883 net7.0-windows-Debug-x86-CoreCLR_checked-Windows.10.Amd64.Open console.log runclient.py
1726874 runtime PR 67883 net7.0-Linux-Debug-arm-CoreCLR_checked-(Ubuntu.1804.Arm32.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 console.log runclient.py
1726874 runtime PR 67883 net7.0-Linux-Debug-arm-CoreCLR_checked-(Ubuntu.1804.Arm32.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 console.log runclient.py
1725611 runtime PR 67883 net7.0-Linux-Debug-x64-CoreCLR_release-RedHat.7.Amd64.Open console.log runclient.py
1725611 runtime PR 67883 net7.0-Linux-Debug-x64-CoreCLR_release-RedHat.7.Amd64.Open console.log runclient.py

Build Result Summary

Day Hit Count Week Hit Count Month Hit Count
12 14 14
@dotnet-issue-labeler
Copy link

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.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Apr 21, 2022
@ghost
Copy link

ghost commented Apr 21, 2022

Tagging subscribers to this area: @dotnet/area-system-io-compression
See info in area-owners.md if you want to be subscribed.

Issue Details
❌ System.Formats.Tar.Tests.TarReader_File_Tests.Read_Archive_File [[Details]](https://dev.azure.com/dnceng//public/_build/results?buildId=1731384&view=ms.vss-test-web.build-test-results-tab&runId=46911660&resultId=125928&paneView=debug) [[History]](https://dev.azure.com/dnceng//public/_build/results?buildId=1731384&view=ms.vss-test-web.build-test-results-tab&runId=46911660&resultId=125928&paneView=history) [[Artifacts]](https://dev.azure.com/dnceng//public/_build/results?buildId=1731384&view=ms.vss-test-web.build-test-results-tab&runId=46911660&resultId=125928&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab)
Data Driven SubResults
❌ System.Formats.Tar.Tests.TarReader_File_Tests.Read_Archive_File(format: Pax, testFormat: pax)
Exception Message
System.IO.IOException : The process cannot access the file '/mnt/work/B12709CA/w/BB4B09F1/e/tar/pax/file.tar' because it is being used by another process.
Stack Trace
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Init(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Int64& fileLength, Permissions& filePermissions) in /_/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs:line 448
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Permissions openPermissions, Int64& fileLength, Permissions& filePermissions, Func`4 createOpenException) in /_/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs:line 224
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Permissions openPermissions, Func`4 createOpenException) in /_/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs:line 189
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) in /_/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/OSFileStreamStrategy.cs:line 46
   at System.IO.Strategies.UnixFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) in /_/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/UnixFileStreamStrategy.cs:line 15
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) in /_/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Unix.cs:line 17
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) in /_/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.cs:line 24
   at System.IO.FileStream..ctor(String path, FileStreamOptions options) in /_/src/libraries/System.Private.CoreLib/src/System/IO/FileStream.cs:line 205
   at System.Formats.Tar.Tests.TarTestsBase.GetTarMemoryStream(CompressionMethod compressionMethod, TestTarFormat format, String testCaseName) in /_/src/libraries/System.Formats.Tar/tests/TarTestsBase.cs:line 110
   at System.Formats.Tar.Tests.TarReader_File_Tests.Read_Archive_File(TarFormat format, TestTarFormat testFormat) in /_/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.cs:line 24
   at System.Reflection.RuntimeMethodInfo.InvokeNonEmitUnsafe(Object obj, IntPtr* byrefParameters, Span`1 argsForTemporaryMonoSupport, BindingFlags invokeAttr) in /_/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.Mono.cs:line 397
Pass Rate
Test has failed 16 out of 702 runs (2.28%)
Failing Configuration
net7.0-Linux-Debug-x64-Mono_release-RedHat.7.Amd64.Open
Author: danmoseley
Assignees: -
Labels:

area-System.IO.Compression, untriaged

Milestone: -

@danmoseley
Copy link
Member Author

cc @carlossanlop

@danmoseley
Copy link
Member Author

danmoseley commented Apr 21, 2022

        [Fact]
        public void Extract_Archive_File_OverwriteTrue()
        {
            string testCaseName = "file";
            string archivePath = GetTarFilePath(CompressionMethod.Uncompressed, TestTarFormat.pax, testCaseName);

can run concurrently with

        public void Read_Archive_File(TarFormat format, TestTarFormat testFormat)
        {
            string testCaseName = "file";
            using MemoryStream ms = GetTarMemoryStream(CompressionMethod.Uncompressed, testFormat, testCaseName);

and the former appears to write to tar/pax/file.tar.

as well as changing one of the "testCaseName" should we be writing to %temp% not current directory?

C:\git\runtime\src\libraries\System.Formats.Tar\tests\TarTestsBase.cs:
   82  
   83          protected static string GetTestCaseUnarchivedFolderPath(string testCaseName) =>
   84:             Path.Join(Directory.GetCurrentDirectory(), "unarchived", testCaseName);
   85  
   86          protected static string GetTarFilePath(CompressionMethod compressionMethod, TestTarFormat format, string testCaseName)
   ..
   93              };
   94  
   95:             return Path.Join(Directory.GetCurrentDirectory(), compressionMethodFolder, format.ToString(), testCaseName + fileExtension);
   96          }
   97  

@danmoseley danmoseley added the blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' label Apr 21, 2022
@danmoseley
Copy link
Member Author

I'll throw up a fix

@danmoseley
Copy link
Member Author

I take that back. They don't write to the tar file. But we open tar files to read them with FileShare.None.


@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Apr 22, 2022
@carlossanlop carlossanlop self-assigned this Apr 22, 2022
@carlossanlop
Copy link
Member

Thanks @danmoseley for sending the fix.

@ghost ghost removed untriaged New issue has not been triaged by the area owner in-pr There is an active PR which will close this issue when it is merged labels Apr 22, 2022
@ghost ghost locked as resolved and limited conversation to collaborators May 22, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
area-System.Formats.Tar blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants