[Bug]: Intermittent Failure in MergeManyChangeSet stress tests

未关闭
#1,130 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
csharp
领域
testing-qa

调研方向

Start with DynamicData.Tests/Cache/MergeManyChangeSetsCacheSourceCompareFixture.cs, especially MultiThreadedStressTest and CheckResultContents at the reported lines. Read how the test prepares and applies changes, then run MultiThreadedStressTest(marketCount: 10, priceCount: 50) and the full test suite to investigate the intermittent failure. Done means the stress phase iterates over pre-calculated changes and the test passes reliably.

由索引模型根据 Issue 内容生成。

描述

bug

Specifically, MultiThreadedStressTest(marketCount: 10, priceCount: 50).

Expected expectedPrices to be a subset of {00043 - $17.14 (908cd9c5-a71e-4d5d-bec1-8be17a11aa74) [04:30:19.7121397], 00031 - $19.81 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:19.6551006], 00029 - $15.87 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:19.6990594], 00026 - $11.98 (8796be1f-5fbc-41c5-9b75-d3d9f6eabaf7) [04:30:19.3459877], 00045 - $16.26 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:19.7331625], 00034 - $12.21 (8796be1f-5fbc-41c5-9b75-d3d9f6eabaf7) [04:30:19.6549346], 00028 - $13.69 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:20.7164349], 00008 - $16.76 (8796be1f-5fbc-41c5-9b75-d3d9f6eabaf7) [04:30:19.9883224], 00039 - $14.28 (908cd9c5-a71e-4d5d-bec1-8be17a11aa74) [04:30:19.2575177], 00017 - $19.74 (8796be1f-5fbc-41c5-9b75-d3d9f6eabaf7) [04:30:19.4937616], 00003 - $16.44 (908cd9c5-a71e-4d5d-bec1-8be17a11aa74) [04:30:19.4401790], 00012 - $15.08 (908cd9c5-a71e-4d5d-bec1-8be17a11aa74) [04:30:19.3240127], 00027 - $10.57 (8796be1f-5fbc-41c5-9b75-d3d9f6eabaf7) [04:30:19.3489598], 00019 - $16.96 (908cd9c5-a71e-4d5d-bec1-8be17a11aa74) [04:30:19.6803881], 00007 - $19.79 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:19.9574974], 00010 - $16.34 (8796be1f-5fbc-41c5-9b75-d3d9f6eabaf7) [04:30:19.5941191], 00005 - $13.77 (908cd9c5-a71e-4d5d-bec1-8be17a11aa74) [04:30:19.5584471], 00042 - $18.60 (8796be1f-5fbc-41c5-9b75-d3d9f6eabaf7) [04:30:19.8431487], 00048 - $12.38 (908cd9c5-a71e-4d5d-bec1-8be17a11aa74) [04:30:19.6095954], 00030 - $14.85 (8796be1f-5fbc-41c5-9b75-d3d9f6eabaf7) [04:30:19.8428521], 00040 - $10.36 (908cd9c5-a71e-4d5d-bec1-8be17a11aa74) [04:30:20.6624405], 00036 - $13.48 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:21.0277931], 00032 - $11.72 (908cd9c5-a71e-4d5d-bec1-8be17a11aa74) [04:30:19.8416787], 00021 - $18.73 (8796be1f-5fbc-41c5-9b75-d3d9f6eabaf7) [04:30:19.4317234], 00025 - $13.77 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:20.7149507], 00020 - $16.89 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:21.2080025], 00035 - $10.99 (0ce00eb2-6aba-4ae6-a930-0e1d937abc8b) [04:30:19.9152008], 00018 - $19.49 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:19.9572357], 00041 - $17.78 (8796be1f-5fbc-41c5-9b75-d3d9f6eabaf7) [04:30:19.5240783], 00016 - $13.73 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:20.6621514], 00023 - $11.29 (6be74f10-fc3e-4609-aa2d-6c6da1b09091) [04:30:19.6143894], 00049 - $10.38 (908cd9c5-a71e-4d5d-bec1-8be17a11aa74) [04:30:19.6839938], …11 more…}, but items {00027 - $13.59 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:20.6623978], 00033 - $17.30 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:19.9198414], 00017 - $17.87 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:20.6627700], 00034 - $14.25 (5755abff-26f6-492a-908d-38b5270d5877) [04:30:20.8989351]} are not part of the superset.
   at FluentAssertions.Execution.LateBoundTestFramework.Throw(String message)
   at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
   at FluentAssertions.Execution.AssertionScope.AddPreFormattedFailure(String formattedFailureMessage)
   at FluentAssertions.Execution.AssertionChain.FailWith(Func`1 getFailureReason)
   at FluentAssertions.Execution.AssertionChain.FailWith(Func`1 getFailureReason)
   at FluentAssertions.Execution.AssertionChain.FailWith(String message, Object[] args)
   at FluentAssertions.Execution.GivenSelector`1.FailWith(String message, Object[] args)
   at FluentAssertions.Execution.GivenSelector`1.FailWith(String message, Func`2[] args)
   at FluentAssertions.Collections.GenericCollectionAssertions`3.<>c__DisplayClass24_0.<BeSubsetOf>b__0(AssertionChain chain)
   at FluentAssertions.Execution.AssertionChain.WithExpectation(String message, Action`1 chain, Object[] args)
   at FluentAssertions.Execution.AssertionChain.WithExpectation(String message, Object arg1, Action`1 chain)
   at FluentAssertions.Collections.GenericCollectionAssertions`3.BeSubsetOf(IEnumerable`1 expectedSuperset, String because, Object[] becauseArgs)
   at DynamicData.Tests.Cache.MergeManyChangeSetsCacheSourceCompareFixture.CheckResultContents(ChangeSetAggregator`2 marketResults, ChangeSetAggregator`2 priceResults, IComparer`1 comparer) in /home/Jake/Projects/DynamicData/src/DynamicData.Tests/Cache/MergeManyChangeSetsCacheSourceCompareFixture.cs:line 1093
   at DynamicData.Tests.Cache.MergeManyChangeSetsCacheSourceCompareFixture.MultiThreadedStressTest(Int32 marketCount, Int32 priceCount) in /home/Jake/Projects/DynamicData/src/DynamicData.Tests/Cache/MergeManyChangeSetsCacheSourceCompareFixture.cs:line 128
   at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass47_0.<<InvokeTestMethodAsync>b__1>d.MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestInvoker.cs:line 259
--- End of stack trace from previous location ---
   at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func`1 asyncAction) in /_/src/xunit.execution/Sdk/Frameworks/ExecutionTimer.cs:line 48
   at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in /_/src/xunit.core/Sdk/ExceptionAggregator.cs:line 90

This seems to happen only when running the full test suite, indicating it's not saturating the thread pool. At a glance, I'd wager too much work is being done during the stress phase, and not enough during setup. The goal of a concurrency stress test is to make it as likely as possible for the concurrency mechanisms to overlap, thus exposing a race, and that likelihood goes down the more stuff is being done between concurrency checks. I.E. try re-writing this to pre-calculate the sequences of changes to be made, and then just iterate over them during the stress phase.

主要语言
C#
星标
1.9k
派生
194
平均合并
12 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

reactivemarbles/DynamicData 的其他 Issue

查看 reactivemarbles/DynamicData 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。