Investigate deadlock, hanging of tests in CI, whether it is CI, F# tasks, TaskSeq CE or XUnit, see also #25#27
Closed
abelbraaksma wants to merge 5 commits intomainfrom
Closed
Investigate deadlock, hanging of tests in CI, whether it is CI, F# tasks, TaskSeq CE or XUnit, see also #25#27abelbraaksma wants to merge 5 commits intomainfrom
abelbraaksma wants to merge 5 commits intomainfrom
Conversation
…ning for parallel running
4e30077 to
26e6b1f
Compare
Re-enable parallelization Blame-timeout to 60s
…ind out whether a test has started (but not finished) Log "starting a test", because xUnit does not do it
* Skip all tests and run by hand, i.e. reflection-based runner test * Implement our own test runner * Run parallelized self-written testrunner several times in parallel
26e6b1f to
d202650
Compare
abelbraaksma
added a commit
that referenced
this pull request
Oct 15, 2022
abelbraaksma
added a commit
that referenced
this pull request
Oct 15, 2022
Member
Author
|
Closing this, we run "in parallel" locally just fine, both in NCrunch, from commandline and in VS 2022, so this only affects CI, where we disabled "in parallel". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(see at bottom for original issue description and research)
xUnit bug, see this report
It turns out that if the following is true,
xUnitends up in a deadlock in CI, but not locally:Task<unit>-returning testsThe example in xunit/xunit#2587 is given as two tasks that do a
Task.Delay(1), which, as we all know, will yield and pause for the length of at least one timer event (which is15.6mson most systems). Even though there are no shared variables, it leads to a deadlock.A good analysis is in this comment: dotnet/BenchmarkDotNet#2114 (comment).
Possibly related: dotnet/corefx#559 (i.e., that the diff between local and CI is that on CI there are simply not enough threads in the thread pool and thread starvation causes the deadlock).
Solution (for now)
There are only two possible solutions that I can think of, given that the issue isn't likely to be solved any time soon (this is not a critique, it is just a nature of this kind of problems):
asynclibrary forIAsyncEnumerable<_>and we really want to catch any potential parallelism issues.Original text
Trial and error approach:
dotnet testwith--blame-hang-timeout 15000mson the commandline in CI[<assembly: Xunit.CollectionBehavior(DisableTestParallelization = true)>]the tests run fineFollow up: running in "Crunch mode" (using NCrunch) for several hours using as many parallel threads as possible gives no issues.
Follow-up: the green test runs were either non parallel, or self-parallelized, still unclear. Edit: see above.
Follow up: it is not. It is an xUnit bug for their CI runner.
Follow up: CI or Windows or dotnet version on CI has nothing to do with this issue, these tests run fine.
dotnet testconfigurations