Skip to content
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

Changed Dictionary to ConcurrentDictionary #5097

Merged
merged 2 commits into from
May 7, 2020
Merged

Changed Dictionary to ConcurrentDictionary #5097

merged 2 commits into from
May 7, 2020

Conversation

harishsk
Copy link
Contributor

@harishsk harishsk commented May 6, 2020

We are seeing new test failure sporadically with the following call stack:

[xUnit.net 00:00:05.18]     Microsoft.ML.Functional.Tests.Debugging.ViewTrainingOutput [FAIL]

  X Microsoft.ML.Functional.Tests.Debugging.ViewTrainingOutput [16ms]
  Error Message:
   System.InvalidOperationException : Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
  Stack Trace:
     at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
   at Microsoft.ML.Functional.Tests.Debugging.LogWatcher.ObserveEvent(Object sender, LoggingEventArgs e) in /Users/runner/runners/2.166.3/work/1/s/test/Microsoft.ML.Functional.Tests/Debugging.cs:line 204
   at Microsoft.ML.MLContext.ProcessMessage(IMessageSource source, ChannelMessage message) in /Users/runner/runners/2.166.3/work/1/s/src/Microsoft.ML.Data/MLContext.cs:line 135
   at Microsoft.ML.Runtime.HostEnvironmentBase`1.Dispatcher`1.DispatchCore(IMessageSource sender, TMessage message) in /Users/runner/runners/2.166.3/work/1/s/src/Microsoft.ML.Core/Environment/HostEnvironmentBase.cs:line 314

Since the dictionary is being modified by multiple threads, I am changing this to a ConcurrentDictionary.

@harishsk harishsk requested a review from a team as a code owner May 6, 2020 20:02
Copy link
Contributor

@frank-dong-ms-zz frank-dong-ms-zz left a comment

Choose a reason for hiding this comment

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

:shipit:

@codecov
Copy link

codecov bot commented May 6, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@b74cacc). Click here to learn what that means.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##             master    #5097   +/-   ##
=========================================
  Coverage          ?   75.61%           
=========================================
  Files             ?      993           
  Lines             ?   178514           
  Branches          ?    19191           
=========================================
  Hits              ?   134987           
  Misses            ?    38298           
  Partials          ?     5229           
Flag Coverage Δ
#Debug 75.61% <100.00%> (?)
#production 71.57% <ø> (?)
#test 88.64% <100.00%> (?)
Impacted Files Coverage Δ
test/Microsoft.ML.Functional.Tests/Debugging.cs 100.00% <100.00%> (ø)

@harishsk harishsk merged commit fd53d21 into dotnet:master May 7, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Mar 18, 2022
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.

3 participants