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

Don't create multiple large files at the same time #62519

Merged
merged 4 commits into from
Dec 12, 2021

Conversation

adamsitnik
Copy link
Member

@adamsitnik adamsitnik commented Dec 8, 2021

Related to #56165 (comment), contributes to #56165 (hopefully)

@danmoseley is there any chance you could try this PR on your machine with low disk space?

git clone https://github.com/adamsitnik/runtime.git adsitnik && cd adsitnik && git checkout largeFileTests
.\build.cmd -c Release -subset clr+libs+libs.tests
dotnet build /t:Test .\src\libraries\System.IO.FileSystem\tests\System.IO.FileSystem.Tests.csproj  /p:Configuration=Release /p:Outerloop=true

@adamsitnik adamsitnik added area-System.IO test-enhancement Improvements of test source code labels Dec 8, 2021
@adamsitnik adamsitnik requested a review from danmoseley December 8, 2021 08:53
@ghost
Copy link

ghost commented Dec 8, 2021

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

Issue Details

Related to #56165 (comment), contributes to #56165 (hopefully)

@danmoseley is there any chance you could try this PR on your machine with low disk space?

git clone https://github.com/adamsitnik/runtime.git adsitnik && cd adsitnik && git checkout largeFileTests
.\build.cmd -c Release -subset clr+libs+libs.tests
dotnet build /t:Test .\src\libraries\System.IO.FileSystem\tests\System.IO.FileSystem.Tests.csproj  /p:Configuration=Release
Author: adamsitnik
Assignees: -
Labels:

area-System.IO, test enhancement

Milestone: -

@adamsitnik
Copy link
Member Author

/azp list

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@danmoseley
Copy link
Member

Sure I'll try it out now. machine's disk space is ~10GB

BTW I find gh pr checkout nnnn to be very helpful for this kind of thing too.

@danmoseley
Copy link
Member

danmoseley commented Dec 8, 2021

@adamsitnik it still ran out of disk.

you see the files it was trying to create were in the right places:

      System.IO.FileSystem.Tests.LargeFileTests.ReadFileOver2GBAsync [FAIL]
        System.IO.IOException : There is not enough space on the disk. : 'C:\Users\danmose\AppData\Local\Temp\LargeFileTests_yfuemujx.aqv\ReadFileOver2GBAsync_44_0578bd57'
        Stack Trace:
          C:\git\adsitnik\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\FileStreamHelpers.Windows.cs(128,0): at System.IO.Strategies.FileStreamHelpers.SetFileLength(SafeFileHandle handle, Int64 length)
          C:\git\adsitnik\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\OSFileStreamStrategy.cs(234,0): at System.IO.Strategies.OSFileStreamStrategy.SetLengthCore(Int64 value)
          C:\git\adsitnik\src\libraries\System.IO.FileSystem\tests\LargeFileTests.cs(47,0): at System.IO.FileSystem.Tests.LargeFileTests.ReadFileOver2GBAsync()
          --- End of stack trace from previous location ---
        System.IO.IOException : There is not enough space on the disk. : 'C:\Users\danmose\AppData\Local\Temp\LargeFileTests_lgynieba.ygu\ReadFileOverMaxArrayLength_31_da4c3d20'
      System.IO.FileSystem.Tests.LargeFileTests.ReadFileOverMaxArrayLength [FAIL]
        Stack Trace:
          C:\git\adsitnik\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\FileStreamHelpers.Windows.cs(128,0): at System.IO.Strategies.FileStreamHelpers.SetFileLength(SafeFileHandle handle, Int64 length)
          C:\git\adsitnik\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\OSFileStreamStrategy.cs(234,0): at System.IO.Strategies.OSFileStreamStrategy.SetLengthCore(Int64 value)
          C:\git\adsitnik\src\libraries\System.IO.FileSystem\tests\LargeFileTests.cs(34,0): at System.IO.FileSystem.Tests.LargeFileTests.ReadFileOverMaxArrayLength()
      System.IO.FileSystem.Tests.LargeFileTests.NoInt32OverflowInTheBufferingLogic [FAIL]
        System.IO.IOException : There is not enough space on the disk. : 'C:\Users\danmose\AppData\Local\Temp\LargeFileTests_sb4yip4j.i2z\NoInt32OverflowInTheBufferingLogic_73_8718ad16'
        Stack Trace:
          C:\git\adsitnik\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs(1020,0): at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite()
          C:\git\adsitnik\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs(169,0): at System.IO.Strategies.BufferedFileStreamStrategy.Dispose(Boolean disposing)
          C:\git\adsitnik\src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs(158,0): at System.IO.Stream.Dispose()
          C:\git\adsitnik\src\libraries\System.IO.FileSystem\tests\LargeFileTests.cs(85,0): at System.IO.FileSystem.Tests.LargeFileTests.NoInt32OverflowInTheBufferingLogic()
      System.IO.FileSystem.Tests.LargeFileTests.ReadFileOverMaxArrayLengthAsync [FAIL]
        System.IO.IOException : There is not enough space on the disk. : 'C:\Users\danmose\AppData\Local\Temp\LargeFileTests_tzxp1xbo.h1k\ReadFileOverMaxArrayLengthAsync_57_f6bcc8b7'
        Stack Trace:
          C:\git\adsitnik\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\FileStreamHelpers.Windows.cs(128,0): at System.IO.Strategies.FileStreamHelpers.SetFileLength(SafeFileHandle handle, Int64 length)
          C:\git\adsitnik\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\OSFileStreamStrategy.cs(234,0): at System.IO.Strategies.OSFileStreamStrategy.SetLengthCore(Int64 value)
          C:\git\adsitnik\src\libraries\System.IO.FileSystem\tests\LargeFileTests.cs(60,0): at System.IO.FileSystem.Tests.LargeFileTests.ReadFileOverMaxArrayLengthAsync()
          --- End of stack trace from previous location ---
      System.IO.FileSystem.Tests.LargeFileTests.ReadFileOver2GB [FAIL]
        System.IO.IOException : There is not enough space on the disk. : 'C:\Users\danmose\AppData\Local\Temp\LargeFileTests_55b3wisa.xm2\ReadFileOver2GB_18_13dcae8f'
        Stack Trace:
          C:\git\adsitnik\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\FileStreamHelpers.Windows.cs(128,0): at System.IO.Strategies.FileStreamHelpers.SetFileLength(SafeFileHandle handle, Int64 length)
          C:\git\adsitnik\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\OSFileStreamStrategy.cs(234,0): at System.IO.Strategies.OSFileStreamStrategy.SetLengthCore(Int64 value)
          C:\git\adsitnik\src\libraries\System.IO.FileSystem\tests\LargeFileTests.cs(21,0): at System.IO.FileSystem.Tests.LargeFileTests.ReadFileOver2GB()

I had ~9GB free, but these two files filled it up:

C:\Users\danmose\AppData\Local\Temp>
12/07/2021  11:56 PM     4,294,967,311 tmpD2D1.tmp
12/07/2021  07:46 PM     4,294,967,311 tmpF5B4.tmp

I do not understand the time stamps. The tests ran just after 12PM. I looked at one of the files, it was consistent with the writes done in NoInt32OverflowInTheBufferingLogic.

The log above shows that TestDirectory is correct. Do we expect temp files to be created as part of the process of writing these large files?

BTW does FileCleanupTestBase get disposed every test? I suspect it is every test fixture. So all files created by this class must exist together.

@danmoseley
Copy link
Member

Hmm, all LargeFileTest failed. So it is not them creating the file. hmm

@danmoseley
Copy link
Member

And now after cleaning everything, I can't repro it. I suggest to commit this as it's an improvement and I'll look if it happens again.

Please do check that the files are deleted between each test though. As it is, they require ~4GB free space each.

…wn file

use single large file to test File.ReadAllBytes and ile.ReadAllBytesAsync for both limits
@adamsitnik
Copy link
Member Author

Please do check that the files are deleted between each test though

I've used FileOptions.DeleteOnClose to ensure that each file is removed before the test finishes.

I've also merged 4 tests that were testing File.ReadAllBytes and File.ReadAllBytes for two file sizes into one, so instead of creating four 2 GB files, we create a single one.

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@danmoseley
Copy link
Member

what?!

    System.ServiceProcess.Tests.ServiceBaseTests.TestOnExecuteCustomCommand [FAIL]
      System.TypeLoadException : Could not load type 'Advapi32' from assembly 'System.ServiceProcess.ServiceController.TestService, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' because the method 'CreateService' has no implementation (no RVA).
      Stack Trace:
           at System.ServiceProcess.Tests.TestServiceInstaller.Install()
        /_/src/libraries/System.ServiceProcess.ServiceController/tests/TestServiceProvider.cs(131,0): at System.ServiceProcess.Tests.TestServiceProvider.CreateTestServices()
        /_/src/libraries/System.ServiceProcess.ServiceController/tests/TestServiceProvider.cs(84,0): at System.ServiceProcess.Tests.TestServiceProvider..ctor(String serviceName)
        /_/src/libraries/System.ServiceProcess.ServiceController/tests/TestServiceProvider.cs(69,0): at System.ServiceProcess.Tests.TestServiceProvider..ctor()
        /_/src/libraries/System.ServiceProcess.ServiceController/tests/ServiceBaseTests.cs(29,0): at System.ServiceProcess.Tests.ServiceBaseTests..ctor()
        /_/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs(3747,0): at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)

@danmoseley
Copy link
Member

rerunning failed

@adamsitnik
Copy link
Member Author

#62616

It's #62616

rerunning failed

You mean re-running the CI legs or the IO tests locally on your machine with limited disk space?

@danmoseley
Copy link
Member

I just meant i clicked the button to rerun them in Azdo. I don't think we need to do more local testing.

@danmoseley
Copy link
Member

Validation results look good to me.

@danmoseley
Copy link
Member

I am satisfied that failures are unrelated.

@danmoseley danmoseley merged commit 03194f7 into dotnet:main Dec 12, 2021
@adamsitnik adamsitnik deleted the largeFileTests branch December 16, 2021 09:22
@adamsitnik adamsitnik added this to the 7.0.0 milestone Dec 16, 2021
jozkee pushed a commit to jozkee/runtime that referenced this pull request Dec 21, 2021
* move existing large file tests into a separate type (no code changes)

* don't run the large file tests in parallel

* use FileOptions.DeleteOnClose to ensure that each test removes it's own file

use single large file to test File.ReadAllBytes and ile.ReadAllBytesAsync for both limits
danmoseley added a commit that referenced this pull request Dec 31, 2021
)

* Move NoInt32OverflowInTheBufferingLogic to OuterLoop and address pending feedback (#60606)

* Don't create multiple large files at the same time (#62519)

* move existing large file tests into a separate type (no code changes)

* don't run the large file tests in parallel

* use FileOptions.DeleteOnClose to ensure that each test removes it's own file

use single large file to test File.ReadAllBytes and ile.ReadAllBytesAsync for both limits

* Fix DisableParallelization build issue

* Apply suggestions from code review

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>

* Update src/libraries/System.IO.FileSystem/tests/LargeFileTests.cs

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>

* Notepad with uppercase (#62487)

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Co-authored-by: Dan Moseley <danmose@microsoft.com>
@ghost ghost locked as resolved and limited conversation to collaborators Jan 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.IO test-enhancement Improvements of test source code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants