Bug 3756 - Broken locking in CancellationTokenSource
Summary: Broken locking in CancellationTokenSource
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 2.10.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Jérémie Laval
URL:
Depends on:
Blocks:
 
Reported: 2012-03-05 12:22 UTC by Alan McGovern
Modified: 2012-03-06 05:25 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Alan McGovern 2012-03-05 12:22:54 UTC
I just got this starting up the debugger trying to debug MonoDevelop

System.InvalidOperationException: out of sync
  at System.Collections.Generic.Dictionary`2+Enumerator[System.Threading.CancellationTokenRegistration,System.Action].VerifyState () [0x00028] in /Users/alanmcgovern/Projects/mono/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:966 
  at System.Collections.Generic.Dictionary`2+Enumerator[System.Threading.CancellationTokenRegistration,System.Action].MoveNext () [0x00000] in /Users/alanmcgovern/Projects/mono/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:889 
  at System.Threading.CancellationTokenSource.Cancel (Boolean throwOnFirstException) [0x00089] in /Users/alanmcgovern/Projects/mono/mcs/class/corlib/System.Threading/CancellationTokenSource.cs:131 
  at System.Threading.CancellationTokenSource.Cancel () [0x00000] in /Users/alanmcgovern/Projects/mono/mcs/class/corlib/System.Threading/CancellationTokenSource.cs:116 
  at MonoDevelop.Debugger.GtkConnectionDialog.Dispose () [0x00025] in /Users/alanmcgovern/Projects/monodevelop/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs:1024 
  at Mono.Debugging.Soft.SoftDebuggerSession.HideConnectionDialog () [0x0000d] in /Users/alanmcgovern/Projects/monodevelop/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs:397 
  at Mono.Debugging.Soft.SoftDebuggerSession.ConnectionStarted (Mono.Debugger.Soft.VirtualMachine vm) [0x00064] in /Users/alanmcgovern/Projects/monodevelop/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs:426 
  at Mono.Debugging.Soft.SoftDebuggerSession.<StartLaunching>m__8 (IAsyncResult ar) [0x00001] in /Users/alanmcgovern/Projects/monodevelop/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs:208 
  at Mono.Debugging.Soft.SoftDebuggerSession+<HandleConnectionCallbackErrors>c__AnonStorey7.<>m__B (IAsyncResult ar) [0x0000e] in /Users/alanmcgovern/Projects/monodevelop/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs:317
Comment 1 Mikayla Hutchinson [MSFT] 2012-03-05 12:57:25 UTC
Looks like bad locking in CancellationTokenSource.cs, it's protecting callbacks by locking on two different objects.
Comment 2 Jérémie Laval 2012-03-06 05:25:28 UTC
Fixed in master and mono-2-10 branch.