Skip to content

Avoid running GetDisplayNameTests in parallel #2701

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

Merged
merged 1 commit into from
Mar 21, 2022

Conversation

tlakollo
Copy link
Contributor

There seems to be a race condition on Cecil while trying to get GenericParameters, if a multithreaded test asks simultaneously about GenericParameters on the same type Cecil answers could vary creating test failures.
Fixes #2693

There seems to be a race condition on Cecil while trying to get GenericParameters, if a multithreaded test asks simultaneously about GenericParameters on the same type Cecil answers could vary creating test failures. 
Fixes #2693
@tlakollo tlakollo requested a review from marek-safar as a code owner March 21, 2022 23:23
@tlakollo tlakollo self-assigned this Mar 21, 2022
Copy link
Member

@sbomer sbomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tlakollo tlakollo merged commit 5d8277a into main Mar 21, 2022
@tlakollo tlakollo deleted the DisableParallelExecutionOnTest branch March 21, 2022 23:54
@marek-safar
Copy link
Contributor

Do you know which Cecil piece is causing this?

@tlakollo
Copy link
Contributor Author

Given that the problematic code in linker is https://github.com/dotnet/linker/blob/main/src/linker/Linker/TypeReferenceExtensions.cs#L43-L58
We could assume that is likely caused because the count of genericParametersCount or declaringTypeGenericParametersCount was incorrect. Causing the code to go to the else statement and print the incorrect type.
That would make https://github.com/mono/cecil/blob/main/Mono.Cecil/IGenericParameterProvider.cs#L46-L56 in Cecil the possible cause. Given that is likely that the problem will go away while debugging the bug would need to be found only by code inspection. Spending a few min looking at the code there, it seems to be like it should run fine, so it might be something subtle.

agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
There seems to be a race condition on Cecil while trying to get GenericParameters, if a multithreaded test asks simultaneously about GenericParameters on the same type Cecil answers could vary creating test failures. 
Fixes dotnet/linker#2693

Commit migrated from dotnet/linker@5d8277a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TestGetDisplayName is flaky
3 participants