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

AccessViolationException breaks System.IO.FileSystem tests #66515

Closed
deeprobin opened this issue Mar 11, 2022 · 8 comments
Closed

AccessViolationException breaks System.IO.FileSystem tests #66515

deeprobin opened this issue Mar 11, 2022 · 8 comments

Comments

@deeprobin
Copy link
Contributor

Description

...
        Condition(s) not met: "IsCaseSensitiveOS"
      System.IO.Tests.DirectoryInfo_GetDirectories_str_so.SearchPatternCaseSensitive [SKIP]
        Condition(s) not met: "IsCaseSensitiveOS"
      System.IO.Tests.DirectoryInfo_GetSetTimes.TimesIncludeMillisecondPart_LowTempRes [SKIP]
        Condition(s) not met: "LowTemporalResolution"
      System.IO.Tests.File_Create_str.CaseSensitive [SKIP]
        Condition(s) not met: "IsCaseSensitiveOS"
      System.IO.Tests.Directory_GetSetTimes.TimesIncludeMillisecondPart_LowTempRes [SKIP]
        Condition(s) not met: "LowTemporalResolution"
  Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
     at System.Threading.Thread.get_OptimalMaxSpinWaitsPerSpinIteration()
     at System.Threading.LowLevelSpinWaiter.Wait(Int32, Int32, Int32)
     at System.Threading.LowLevelLifoSemaphore.Wait(Int32, Boolean)
     at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()

Reproduction Steps

  • Pull from main
  • Build CLR+Libs with -config Release
  • cd src/libraries/System.IO.FileSystem/tests
  • dotnet build /t:Test /p:Configuration=Release

Expected behavior

Test pass

Actual behavior

AccessViolationException

Regression?

No response

Known Workarounds

No response

Configuration

Windows-x64

Other information

I am not sure if the test can be reproduced 100%. It only occurs sometimes.

This might have something to do with Issue #46381.
@danmoseley you might know more about it?

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.IO untriaged New issue has not been triaged by the area owner labels Mar 11, 2022
@ghost
Copy link

ghost commented Mar 11, 2022

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

Issue Details

Description

...
        Condition(s) not met: "IsCaseSensitiveOS"
      System.IO.Tests.DirectoryInfo_GetDirectories_str_so.SearchPatternCaseSensitive [SKIP]
        Condition(s) not met: "IsCaseSensitiveOS"
      System.IO.Tests.DirectoryInfo_GetSetTimes.TimesIncludeMillisecondPart_LowTempRes [SKIP]
        Condition(s) not met: "LowTemporalResolution"
      System.IO.Tests.File_Create_str.CaseSensitive [SKIP]
        Condition(s) not met: "IsCaseSensitiveOS"
      System.IO.Tests.Directory_GetSetTimes.TimesIncludeMillisecondPart_LowTempRes [SKIP]
        Condition(s) not met: "LowTemporalResolution"
  Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
     at System.Threading.Thread.get_OptimalMaxSpinWaitsPerSpinIteration()
     at System.Threading.LowLevelSpinWaiter.Wait(Int32, Int32, Int32)
     at System.Threading.LowLevelLifoSemaphore.Wait(Int32, Boolean)
     at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()

Reproduction Steps

  • Pull from main
  • Build CLR+Libs with -config Release
  • cd src/libraries/System.IO.FileSystem/tests
  • dotnet build /t:Test /p:Configuration=Release

Expected behavior

Test pass

Actual behavior

AccessViolationException

Regression?

No response

Known Workarounds

No response

Configuration

Windows-x64

Other information

I am not sure if the test can be reproduced 100%. It only occurs sometimes.

This might have something to do with Issue #46381.
@danmoseley you might know more about it?

Author: deeprobin
Assignees: -
Labels:

area-System.IO, untriaged

Milestone: -

@deeprobin
Copy link
Contributor Author

Using dotnet test -config Release I get the following result:

...
  System.Diagnostics.EventLog -> E:\external\dotnet\runtime\artifacts\bin\System.Diagnostics.EventLog\ref\Release\net7.0\System.Diagnostics.EventLog.dll
  System.Diagnostics.EventLog -> E:\external\dotnet\runtime\artifacts\bin\System.Diagnostics.EventLog\Release\net7.0-windows\System.Diagnostics.EventLog.dll
  System.ServiceProcess.ServiceController -> E:\external\dotnet\runtime\artifacts\bin\System.ServiceProcess.ServiceController\ref\Release\net7.0\System.ServiceProcess.ServiceController.dll
  System.ServiceProcess.ServiceController -> E:\external\dotnet\runtime\artifacts\bin\System.ServiceProcess.ServiceController\Release\net7.0-windows\System.ServiceProcess.ServiceController.dll
  StreamConformanceTests -> E:\external\dotnet\runtime\artifacts\bin\StreamConformanceTests\Release\net7.0\StreamConformanceTests.dll
  System.IO.FileSystem.Tests -> E:\external\dotnet\runtime\artifacts\bin\System.IO.FileSystem.Tests\Release\net7.0-windows\System.IO.FileSystem.Tests.dll
Testlauf für "E:\external\dotnet\runtime\artifacts\bin\System.IO.FileSystem.Tests\Release\net7.0-windows\System.IO.FileSystem.Tests.dll" (.NETCoreApp,Version=v7.0)
Die Testausführung wird gestartet, bitte warten...
Insgesamt 1 Testdateien stimmten mit dem angegebenen Muster überein.
Der aktive Testlauf wurde abgebrochen. Grund: Der Testhostprozess ist abgestürzt. : Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at System.Threading.Thread.get_OptimalMaxSpinWaitsPerSpinIteration()
   at System.Threading.LowLevelSpinWaiter.Wait(Int32, Int32, Int32)
   at System.Threading.LowLevelLifoSemaphore.Wait(Int32, Boolean)
   at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()

Ergebnisdatei: E:\external\dotnet\runtime\artifacts\bin\System.IO.FileSystem.Tests\Release\net7.0-windows\TestResults\robin_ROBIN-PC_2022-03-11_19_37_56.trx
HTML-Testergebnisdatei: E:\external\dotnet\runtime\artifacts\bin\System.IO.FileSystem.Tests\Release\net7.0-windows\TestResults\TestResult_robin_ROBIN-PC_20220311_193756.html

Der Testlauf wurde mit dem Fehler System.Exception: One or more errors occurred.
 ---> System.Exception: Unable to read data from the transport connection: Eine vorhandene Verbindung wurde vom Remotehost geschlossen..
 ---> System.Exception: Eine vorhandene Verbindung wurde vom Remotehost geschlossen.
   at System.Net.Sockets.NetworkStream.Read(Span`1 buffer)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Span`1 buffer)
   at System.Net.Sockets.NetworkStream.ReadByte()
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at System.IO.BinaryReader.ReadString()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.LengthPrefixCommunicationChannel.NotifyDataAvailable()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TcpClientExtensions.MessageLoopAsync(TcpClient client, ICommunicationChannel channel, Action`1 errorHandler, CancellationToken cancellationToken)
   --- End of inner exception stack trace --- abgebrochen.

@danmoseley
Copy link
Member

Using dotnet test -config Release I get the following result:

The 2nd stack is simply what vs test does when the child test process dies spontaneously. I linked the issue.

@danmoseley
Copy link
Member

I'll try running locally.

@danmoseley
Copy link
Member

I see no failure. I"ll leave it looping, but I suspect your environment somehow as these tests run all the time in PR's, rolling etc.

Does it repro if you clean the repo and then rerun those steps?

All I can think of is that you're on a German locale OS, but I don't know how that could be relevant.

@danmoseley
Copy link
Member

Also what are your precise steps? You mention CLR+Libs but I think you also need to build libs.tests.

Is your repo on FAT32?

@deeprobin
Copy link
Contributor Author

I see no failure. I"ll leave it looping, but I suspect your environment somehow as these tests run all the time in PR's, rolling etc.

Does it repro if you clean the repo and then rerun those steps?

After a git clean -xdf the test works again strangely enough.
I clean the repo regularly due to any build complications.
With a repo of this size, that's probably fine. But maybe we should make the build more stable in the long run.

Also what are your precise steps? You mention CLR+Libs but I think you also need to build libs.tests.

As far as I know build.cmd /t:Test builds the tests and executes them. This is also described here: https://github.com/dotnet/runtime/blob/main/docs/workflow/testing/libraries/testing.md#running-tests-for-a-single-library.
To rebuild the whole tests because of only one small changed test case takes very long.

Is your repo on FAT32?

No its NTFS.

@danmoseley
Copy link
Member

OK, I believe your build was in a broken state. For example, you built it, then you pulled, then you built only part of it, leaving a combination of binaries that cannot work together. That is not a build stability problem. When you get a wierd failure like this, cleaning and rebuilding is a good thing to do before opening an issue.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 11, 2022
@jeffhandley jeffhandley removed the untriaged New issue has not been triaged by the area owner label May 6, 2022
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

3 participants