Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Fix MMF test failure due to inheritable handles#6984

Merged
stephentoub merged 1 commit intodotnet:masterfrom
stephentoub:map_process
Mar 17, 2016
Merged

Fix MMF test failure due to inheritable handles#6984
stephentoub merged 1 commit intodotnet:masterfrom
stephentoub:map_process

Conversation

@stephentoub
Copy link
Member

Some tests create maps with inheritable handles. Other tests launch processes. If those tests end up running concurrently in a manner where the launched process inherits the handle, it'll end up extending the lifetime of the map beyond what the tests were expecting. This has been leading to random test failures like "Cannot create a file when that file already exists".

This commit simply disables parallelization of the MMF tests. This has little impact on the running time of the tests, but if in the future we add the ability to disable inheriting handles when using Process.Start, we could use that instead.

Fixes https://github.com/dotnet/corefx/issues/6911
cc: @ericeil, @ianhays

Some tests create maps with inheritable handles.  Other tests launch processes.  If those tests end up running concurrently in a manner where the launched process inherits the handle, it'll end up extending the lifetime of the map beyond what the tests were expecting.  This has been leading to random test failures like "Cannot create a file when that file already exists".

This commit simply disables parallelization of the MMF tests.  This has little impact on the running time of the tests, but if in the future we add the ability to disable inheriting handles when using Process.Start, we could use that instead.
@stephentoub
Copy link
Member Author

@dotnet-bot test this please

1 similar comment
@stephentoub
Copy link
Member Author

@dotnet-bot test this please

@ericeil
Copy link
Contributor

ericeil commented Mar 17, 2016

If this turns out to be a more widespread problem, I wonder if it might be worth solving it more generally. For example, could we define attributes like:

[SharedLock("InheritableHandles")]
[ExclusiveLock("InheritableHandles")]

...so any tests marked with [SharedLock(foo)] could run concurrently with other tests marked the same way, but not with other tests marked [ExclusiveLock(foo)]....

Even if we do provide a way to create processes that don't inherit handles, we'll still need to test the mode where handles are inherited... And this it sort of problem is bound to come up elsewhere as well.

But yeah, it's overkill for this change. :) LGTM.

@stephentoub
Copy link
Member Author

Thanks, Eric. Certainly something we can investigate for the future. Given the extensibility points currently available via xunit, I believe that would either require using such attributes instead of Fact/Theory and writing our own discoverers/test case execution/etc. for those, or plugging in at an even higher level and replacing all of the test execution infrastructure.

stephentoub added a commit that referenced this pull request Mar 17, 2016
Fix MMF test failure due to inheritable handles
@stephentoub stephentoub merged commit a2e4c4d into dotnet:master Mar 17, 2016
@stephentoub stephentoub deleted the map_process branch March 17, 2016 19:49
@karelz karelz modified the milestone: 1.0.0-rtm Dec 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants