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

[browser][io][tests] Failure: System.IO.Tests file for 2GB file reads #45954

Open
Tracked by #64596
kjpou1 opened this issue Dec 11, 2020 · 2 comments
Open
Tracked by #64596

[browser][io][tests] Failure: System.IO.Tests file for 2GB file reads #45954

kjpou1 opened this issue Dec 11, 2020 · 2 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-System.IO
Milestone

Comments

@kjpou1
Copy link
Contributor

kjpou1 commented Dec 11, 2020

64 bit numbers could be the culprit here as it seems to stand out.

            at Object.get64 (http://127.0.0.1:54025/dotnet.js:4354:14) 

The tests are failing with the following:


[03:50:20] fail: [FAIL] System.IO.Tests.File_ReadWriteAllBytes.ReadFileOver2GB
[03:50:20] info: System.IO.IOException : Invalid argument
[03:50:20] info:    at System.IO.FileStream.CheckFileCall(Int64 result, Boolean ignoreNotSupported)
[03:50:20] info:    at System.IO.FileStream.CheckFileCall(Int32 result, Boolean ignoreNotSupported)
[03:50:20] info:    at System.IO.FileStream.SetLengthInternal(Int64 value)
[03:50:20] info:    at System.IO.FileStream.SetLength(Int64 value)
[03:50:20] info:    at System.IO.Tests.File_ReadWriteAllBytes.ReadFileOver2GB()
[03:50:20] info:    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[03:50:21] fail: [FAIL] System.IO.Tests.File_ReadWriteAllBytesAsync.ReadFileOver2GBAsync
[03:50:21] info: System.IO.IOException : Invalid argument
[03:50:21] info:    at System.IO.FileStream.CheckFileCall(Int64 result, Boolean ignoreNotSupported)
[03:50:21] info:    at System.IO.FileStream.CheckFileCall(Int32 result, Boolean ignoreNotSupported)
[03:50:21] info:    at System.IO.FileStream.SetLengthInternal(Int64 value)
[03:50:21] info:    at System.IO.FileStream.SetLength(Int64 value)
[03:50:21] info:    at System.IO.Tests.File_ReadWriteAllBytesAsync.ReadFileOver2GBAsync()

info: ABORT: Assertion failed: undefined
  info: Stacktrace:
  info: Error
            at Object.onAbort (http://127.0.0.1:54025/runtime.js:210:13)
            at abort (http://127.0.0.1:54025/dotnet.js:1389:22)
            at assert (http://127.0.0.1:54025/dotnet.js:588:5)
            at Object.get64 (http://127.0.0.1:54025/dotnet.js:4354:14)
            at ___sys_ftruncate64 (http://127.0.0.1:54025/dotnet.js:4472:29)
            at ftruncate (http://127.0.0.1:54025/dotnet.wasm:wasm-function[15944]:0x2faa12)
            at SystemNative_FTruncate (http://127.0.0.1:54025/dotnet.wasm:wasm-function[7758]:0x22368c)
            at wasm_invoke_iil (http://127.0.0.1:54025/dotnet.wasm:wasm-function[7269]:0x20465b)
            at ves_pinvoke_method (http://127.0.0.1:54025/dotnet.wasm:wasm-function[190]:0x2920a)
            at interp_exec_method (http://127.0.0.1:54025/dotnet.wasm:wasm-function[137]:0xb658)
  info: WASM EXIT 1

See PR: #45949

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.IO untriaged New issue has not been triaged by the area owner labels Dec 11, 2020
@kjpou1 kjpou1 added arch-wasm WebAssembly architecture and removed untriaged New issue has not been triaged by the area owner labels Dec 11, 2020
kjpou1 added a commit that referenced this issue Jan 20, 2021
* [browser][tests][outerloop] Standup OuterLoop tests on CI

* System.Collections.NonGeneric.Tests passing

* System.Console.Tests passing

* System.Diagnostics.DiagnosticSource.Tests passing

* System.Globalization.Tests passing

- See active issue #45951

* System.IO.FileSystem.Tests passing after deactivating test cannot wait on monitors on this runtime.

* System.IO.FileSystem.Tests passing - See active issue: #45954

* Remove fat fingered code.

* Threads not supported on Browser

* Browser does not support monitor

* Browser does not support monitor

* Browser does not support wait on monitors

* Browser does not support wait on monitors

* Add ActiveIssue for DataFlow tests TestNullTarget_CompletionNoCaching

* Add ActiveIssue for DataFlow tests

* Add ActiveIssue for DataFlow tests

* Add threading support conditional

* Change all Cannot wait on monitors on this runtime Browser platform checks to

[ConditionalXXXX(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]

As was suggested in comments

* Address review comment for monitors not supported

* Address review comments

* Add threading supported condition.

```
fail: [FAIL] System.Text.Json.Serialization.Tests.EnumConverterTests.VeryLargeAmountOfEnumsToSerialize
[08:10:56] info: System.PlatformNotSupportedException : Cannot wait on monitors on this runtime.
```
@SamMonoRT SamMonoRT added this to the 6.0.0 milestone Jun 23, 2021
@lewing lewing modified the milestones: 6.0.0, 7.0.0 Jun 24, 2021
@adamsitnik
Copy link
Member

I've hit this limitation when I was working on #60459 earlier today. It seems that large files > 2 GB are simply not supported by WASM.

Sample tests:

[Fact]
public void LargeFilesAreSupported()
{
    const long positon = int.MaxValue + 1L;

    string filePath = GetTestFilePath();
    byte[] data = { 1, 2, 3, 4, 5 };

    using (var stream = new FileStream(filePath, FileMode.Create, FileAccess.Write))
    {
        stream.Seek(positon, SeekOrigin.Begin);
        stream.Write(data);

        Assert.Equal(positon + data.Length, stream.Position);
        Assert.Equal(positon + data.Length, stream.Length);
    }
}

Fails with:

  fail: [FAIL] System.IO.Tests.FileStream_Read.LargeFilesAreSupported
  info: System.IO.IOException : Invalid argument : '/tmp/FileStream_Read_f42bzuwo.p40/LargeFilesAreSupported_70_2a38023c'
  info:    at System.IO.Strategies.FileStreamHelpers.CheckFileCall(Int64 result, String path, Boolean ignoreNotSupported) in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Unix.cs:line 24
  info:    at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset) in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Unix.cs:line 138
  info:    at System.IO.Strategies.OSFileStreamStrategy.Write(ReadOnlySpan`1 buffer) in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/OSFileStreamStrategy.cs:line 282
  info:    at System.IO.Strategies.OSFileStreamStrategy.Write(Byte[] buffer, Int32 offset, Int32 count) in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/OSFileStreamStrategy.cs:line 269
  info:    at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite() in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/BufferedFileStreamStrategy.cs:line 1020
  info:    at System.IO.Strategies.BufferedFileStreamStrategy.Flush(Boolean flushToDisk) in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/BufferedFileStreamStrategy.cs:line 804
  info:    at System.IO.Strategies.BufferedFileStreamStrategy.Flush() in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/BufferedFileStreamStrategy.cs:line 790
  info:    at System.IO.Strategies.BufferedFileStreamStrategy.Dispose(Boolean disposing) in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/BufferedFileStreamStrategy.cs:line 150
  info:    at System.IO.Strategies.BufferedFileStreamStrategy.DisposeInternal(Boolean disposing) in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/BufferedFileStreamStrategy.cs:line 140
  info:    at System.IO.FileStream.Dispose(Boolean disposing) in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/FileStream.cs:line 499
  info:    at System.IO.Stream.Close() in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/Stream.cs:line 165
  info:    at System.IO.Stream.Dispose() in /home/adam/projects/runtime/src/libraries/System.Private.CoreLib/src/System/IO/Stream.cs:line 158
  info:    at System.IO.Tests.FileStream_Read.LargeFilesAreSupported() in /home/adam/projects/runtime/src/libraries/System.IO.FileSystem/tests/FileStream/Read.cs:line 80
  info:    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in /home/adam/projects/runtime/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs:line 370
  info: Finished:    System.IO.FileSystem.Tests.dll

@SamMonoRT @lewing @vargaz are we aware of that? I am asking because the info provided above may suggest that only SetLength does not work, while simply nothing works for such files.

@pavelsavara

This comment was marked as outdated.

@lewing lewing modified the milestones: 8.0.0, Future Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-System.IO
Projects
None yet
Development

No branches or pull requests

6 participants