dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.27k stars 4.74k forks source link

Test failure: MonoTests.System.Configuration.ConfigurationManagerTest/exePath_UserLevelPerRoamingAndLocal #19876

Open ghost opened 7 years ago

ghost commented 7 years ago

Opened on behalf of @Jiayili1

The test MonoTests.System.Configuration.ConfigurationManagerTest/exePath_UserLevelPerRoamingAndLocal has failed.

Assert.Equal() Failure ? (pos 0) Expected: user.config Actual:
? (pos 0)

    Stack Trace:

       at MonoTests.System.Configuration.ConfigurationManagerTest.exePath_UserLevelPerRoamingAndLocal()

Build : Master - 20170111.01 (Core Tests) Failing configurations:

Detail: https://mc.dot.net/#/product/netcore/master/source/official~2Fcorefx~2Fmaster~2F/type/test~2Ffunctional~2Fcli~2F/build/20170111.01/workItem/System.Configuration.Tests/analysis/xunit/MonoTests.System.Configuration.ConfigurationManagerTest~2FexePath_UserLevelPerRoamingAndLocal

danmoseley commented 7 years ago

@JeremyKuhne

KristinXie1 commented 7 years ago

This issue is repro on build 20170203.02, detail: https://mc.dot.net/#/product/netcore/master/source/official~2Fcorefx~2Fmaster~2F/type/test~2Ffunctional~2Fcli~2F/build/20170203.02/workItem/System.Configuration.ConfigurationManager.Tests/analysis/xunit/MonoTests.System.Configuration.ConfigurationManagerTest~2FexePath_UserLevelPerRoamingAndLocal

Message:

Assert.Equal() Failure\n          ? (pos 0)\nExpected: user.config\nActual:   \n          ? (pos 0)

Stack Trace:

at MonoTests.System.Configuration.ConfigurationManagerTest.exePath_UserLevelPerRoamingAndLocal() in /root/corefx/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs:line 165
KristinXie1 commented 7 years ago

This issue is repro on build 20170227.01, detail: https://mc.dot.net/#/product/netcore/master/source/official~2Fcorefx~2Fmaster~2F/type/test~2Ffunctional~2Fcli~2F/build/20170227.01/workItem/System.Configuration.ConfigurationManager.Tests/analysis/xunit/MonoTests.System.Configuration.ConfigurationManagerTest~2FexePath_UserLevelPerRoamingAndLocal

KristinXie1 commented 7 years ago

This issue is repro on build 20170301.02, detail: https://mc.dot.net/#/product/netcore/master/source/official~2Fcorefx~2Fmaster~2F/type/test~2Ffunctional~2Fcli~2F/build/20170301.02/workItem/System.Configuration.ConfigurationManager.Tests/analysis/xunit/MonoTests.System.Configuration.ConfigurationManagerTest~2FexePath_UserLevelPerRoamingAndLocal

KristinXie1 commented 7 years ago

Failed again on build 20170302.02

KristinXie1 commented 7 years ago

Failed again here: https://mc.dot.net/#/product/netcore/master/source/official~2Fcorefx~2Fmaster~2F/type/test~2Ffunctional~2Fcli~2F/build/20170308.04/workItem/System.Configuration.ConfigurationManager.Tests/analysis/xunit/MonoTests.System.Configuration.ConfigurationManagerTest~2FexePath_UserLevelPerRoamingAndLocal

KristinXie1 commented 7 years ago

This issue is repro on 20170318.01

KristinXie1 commented 7 years ago

Failed again on build 20170405.01

KristinXie1 commented 7 years ago

This issue is repro on portable core tests: https://mc.dot.net/#/product/netcore/master/source/official~2Fcorefx~2Fmaster~2F/type/test~2Ffunctional~2Fportable~2Fcli~2F/build/20170407.01/workItem/System.Configuration.ConfigurationManager.Tests/analysis/xunit/MonoTests.System.Configuration.ConfigurationManagerTest~2FexePath_UserLevelPerRoamingAndLocal

danmoseley commented 7 years ago

@JeremyKuhne does this seem important for 2.0? if not we can ask @Jiayili1 to disable the test meantime.

danmoseley commented 7 years ago

We don't believe this is concerning compat issue for 2.0

KristinXie1 commented 7 years ago

This issue doesn't occur on Core Tests in recent builds, so remove the label "test-run-core" first.

Sunny-pu commented 6 years ago

This issue is repro on build 20180611.01, detail: https://mc.dot.net/#/product/netcore/200/source/official~2Fcorefx~2Frelease~2F2.0.0~2F/type/test~2Ffunctional~2Fcli~2F/build/20180611.01/workItem/System.Configuration.ConfigurationManager.Tests/analysis/xunit/MonoTests.System.Configuration.ConfigurationManagerTest~2FexePath_UserLevelPerRoamingAndLocal

Sunny-pu commented 6 years ago

Failed again in 2.0 Branch: https://mc.dot.net/#/product/netcore/200/source/official~2Fcorefx~2Frelease~2F2.0.0~2F/type/test~2Ffunctional~2Fcli~2F/build/20180727.02/workItem/System.Configuration.ConfigurationManager.Tests/analysis/xunit/MonoTests.System.Configuration.ConfigurationManagerTest~2FexePath_UserLevelPerRoamingAndLocal

ericstj commented 5 years ago

Failed again https://dev.azure.com/dnceng/public/_build/results?buildId=184626&view=ms.vss-test-web.build-test-results-tab&runId=4447370&resultId=111207&paneView=debug

System.Configuration.ConfigurationErrorsException : An error occurred loading a configuration file: The process cannot access the file 'C:\\Users\\runner\\AppData\\Local\\Microsoft_Corporation\\xunit.console_StrongName_vmuqnj1rm2vzmtjlxpznjgrpuvgx0hav\\2.5.1.0\\user.config' because it is being used by another process. (C:\\Users\\runner\\AppData\\Local\\Microsoft_Corporation\\xunit.console_StrongName_vmuqnj1rm2vzmtjlxpznjgrpuvgx0hav\\2.5.1.0\\user.config)\r\n---- System.IO.IOException : The process cannot access the file 'C:\\Users\\runner\\AppData\\Local\\Microsoft_Corporation\\xunit.console_StrongName_vmuqnj1rm2vzmtjlxpznjgrpuvgx0hav\\2.5.1.0\\user.config' because it is being used by another process.

Stack trace
   at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal) in D:\a\1\s\src\System.Configuration.ConfigurationManager\src\System\Configuration\ConfigurationSchemaErrors.cs:line 72
   at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors) in D:\a\1\s\src\System.Configuration.ConfigurationManager\src\System\Configuration\BaseConfigurationRecord.cs:line 3659
   at System.Configuration.Configuration..ctor(String locationSubPath, Type typeConfigHost, Object[] hostInitConfigurationParams) in D:\a\1\s\src\System.Configuration.ConfigurationManager\src\System\Configuration\Configuration.cs:line 76
   at System.Configuration.ClientConfigurationHost.OpenExeConfiguration(ConfigurationFileMap fileMap, Boolean isMachine, ConfigurationUserLevel userLevel, String exePath) in D:\a\1\s\src\System.Configuration.ConfigurationManager\src\System\Configuration\ClientConfigurationHost.cs:line 487
   at System.Configuration.ConfigurationManager.OpenExeConfigurationImpl(ConfigurationFileMap fileMap, Boolean isMachine, ConfigurationUserLevel userLevel, String exePath, Boolean preLoad) in D:\a\1\s\src\System.Configuration.ConfigurationManager\src\System\Configuration\ConfigurationManager.cs:line 221
   at MonoTests.System.Configuration.ConfigurationManagerTest.exePath_UserLevelPerRoamingAndLocal() in D:\a\1\s\src\System.Configuration.ConfigurationManager\tests\Mono\ConfigurationManagerTest.cs:line 164
----- Inner Stack Trace -----
   at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle) in F:\workspace\_work\1\s\src\System.Private.CoreLib\shared\System\IO\FileStream.Windows.cs:line 1643
   at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options) in F:\workspace\_work\1\s\src\System.Private.CoreLib\shared\System\IO\FileStream.Win32.cs:line 45
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) in F:\workspace\_work\1\s\src\System.Private.CoreLib\shared\System\IO\FileStream.cs:line 236
   at System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String streamName) in D:\a\1\s\src\System.Configuration.ConfigurationManager\src\System\Configuration\Internal\InternalConfigHost.cs:line 228
   at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName) in D:\a\1\s\src\System.Configuration.ConfigurationManager\src\System\Configuration\Internal\InternalConfigHost.cs:line 60
   at System.Configuration.ClientConfigurationHost.OpenStreamForRead(String streamName) in D:\a\1\s\src\System.Configuration.ConfigurationManager\src\System\Configuration\ClientConfigurationHost.cs:line 282
   at System.Configuration.UpdateConfigHost.OpenStreamForRead(String streamName) in D:\a\1\s\src\System.Configuration.ConfigurationManager\src\System\Configuration\UpdateConfigHost.cs:line 80
   at System.Configuration.ImplicitMachineConfigHost.OpenStreamForRead(String streamName) in D:\a\1\s\src\System.Configuration.ConfigurationManager\src\System\Configuration\ImplicitMachineConfigHost.cs:line 64
   at System.Configuration.BaseConfigurationRecord.InitConfigFromFile() in D:\a\1\s\src\System.Configuration.ConfigurationManager\src\System\Configuration\BaseConfigurationRecord.cs:line 552
ericstj commented 5 years ago

@ViktorHofer here's another test that needs an activeissue tag.

danmoseley commented 5 years ago

Looking at the test, it's not obvious to me that this issue won't just pop up in another test. As an alternative, consider just making the configuration manager tests run serially. If that makes them slow on the dev box, I think it would be fine for the slow ones to be outer loop.

ericstj commented 5 years ago

Well: double check that the config System is using legitimate file sharing value first. If these tests are only reading then I’d expect this to work. Making test serial could hide real bug.

stephentoub commented 5 years ago

it's not obvious to me that this issue won't just pop up in another test

They did: https://github.com/dotnet/corefx/issues/37364 https://github.com/dotnet/corefx/pull/37420

danmoseley commented 5 years ago

@Anipik can you please try making the tests in System.Configuration.ConfigurationManager.Tests. serialized? Let's see whether this helps, as this keeps hapepning.

Then check how long it takes to run - if it's more than a few seconds please make the slowest tests [OuterLoop]. This is not code that is likely to get broken often.

Anipik commented 5 years ago

sure I will try that

danmoseley commented 5 years ago

Well: double check that the config System is using legitimate file sharing value first. If these tests are only reading then I’d expect this to work. Making test serial could hide real bug.

I completely agree with this - but our interest level in this deprecated library is low. I did briefly look at the places it opens file streams and nothing jumped out. If we were to investigate further, I would run in parallel after adding logging around all the file stream open/closes logging their sharing values. Possibly even record the callstack for every open/close and dump all those in flight on failure somehow.

wfurt commented 5 years ago

We should also capture system state. This almost smells like something still runs from previous test runs. For quests not using containers, we do not know what state the system in.

danmoseley commented 5 years ago

We don't plan to investigate further unless this happens again.

stephentoub commented 4 years ago

We don't plan to investigate further unless this happens again.

@danmosemsft, the test is disabled: https://github.com/dotnet/runtime/blob/ccf6aedb63c37ea8e10e4f5b5d9d23a69bdd9489/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs#L159-L160 so it won't happen again ;) I'm going to re-open this. If the fix is to just make the test [PlatformSpecific] for Windows, ok.