Bug 6438 - System.Threading.Timer bug - adding duplicate item to sortedlist - seen intermittently with mono 2.10.x
Summary: System.Threading.Timer bug - adding duplicate item to sortedlist - seen inter...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib (show other bugs)
Version: 2.10.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-08-07 07:10 UTC by Iain
Modified: 2013-01-09 15:39 UTC (History)
3 users (show)

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


Attachments

Description Iain 2012-08-07 07:10:00 UTC
We get the below stacktrace sometimes when changing a timer (Mono 2.10.x).  
Problem is intermittent and hard to reproduce.  Seen it mostly on mac and also I think I recall seeing it on android too.

I suspect it could be related to this commit?

https://github.com/mono/mono/commit/c6ee6980ce22edc50cd950d9531ae46362cde021

Unfortunately I can't find bug #648130 to see why list.IndexOfKey is a no-no for the Scheduler.Add method, but I notice that IndexOfKey is still being used in Scheduler.InternalRemove.  Is that possibly the problem?

Anyway, here's the stacktrace we get:

System.ArgumentException: Key 'System.Threading.Timer' already exists in list.
  at System.Collections.SortedList.PutImpl (System.Object key, System.Object value, Boolean overwrite) [0x00000] in <filename unknown>:0 
  at System.Collections.SortedList.Add (System.Object key, System.Object value) [0x00000] in <filename unknown>:0 
  at System.Threading.Timer+Scheduler.Add (System.Threading.Timer timer) [0x00000] in <filename unknown>:0 
  at System.Threading.Timer+Scheduler.Change (System.Threading.Timer timer, Int64 new_next_run) [0x00000] in <filename unknown>:0 
  at System.Threading.Timer.Change (Int64 dueTime, Int64 period, Boolean first) [0x00000] in <filename unknown>:0 
  at System.Threading.Timer.Change (Int64 dueTime, Int64 period) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Threading.Timer:Change (long,long)
  

Cheers
Iain

Note You need to log in before you can comment on or make changes to this bug.