Bug 1614 - Enumerator.MoveNext() raises System.IndexOutOfRangeException
Summary: Enumerator.MoveNext() raises System.IndexOutOfRangeException
Status: RESOLVED INVALID
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-10-20 12:20 UTC by Will Thompson
Modified: 2012-06-19 17:06 UTC (History)
2 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 INVALID

Description Will Thompson 2011-10-20 12:20:52 UTC
Banshee sporadically crashes at the end of playing a track with System.IndexOutOfRangeException while calling MoveNext() on an Enumerator. 
This was originally reported to <https://bugzilla.gnome.org/show_bug.cgi?id=646723>, where a Banshee developer concluded that this is a Mono bug. Full Banshee log leading up to the crash at http://willthompson.co.uk/misc/2011-10-20.log if this is at all helpful.

The crash is not particularly easy to reproduce, unfortunately; but happens every few days while using Banshee's queue.

Stacktrace:

Unhandled Exception: System.IndexOutOfRangeException: Array index is out of range.
at System.Collections.Generic.List`1/Enumerator<Banshee.Collection.Database.IFilterListModel>.MoveNext () <0x00068>
at Banshee.Collection.Database.DatabaseTrackListModel.Reload (Hyena.Data.IListModel) [0x001ed] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs:317
at Banshee.Collection.Database.DatabaseTrackListModel.Reload () [0x00000] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs:255
at Banshee.Sources.DatabaseSource.RateLimitedReload () [0x0000d] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs:413
at Banshee.Base.RateLimiter.InnerExecute () [0x0001b] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.Base/RateLimiter.cs:64
at Banshee.Base.RateLimiter.Execute () [0x00036] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.Base/RateLimiter.cs:55
at Banshee.Sources.DatabaseSource.Reload () [0x00010] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs:407
at Banshee.SmartPlaylist.SmartPlaylistSource.Reload () [0x0002c] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs:389
at Banshee.SmartPlaylist.SmartPlaylistSource.RefreshAndReload () [0x00006] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs:376
at Banshee.SmartPlaylist.SmartPlaylistSource.HandleTracksChanged (Banshee.Sources.Source,Banshee.Sources.TrackEventArgs) [0x00027] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs:490
at (wrapper delegate-invoke) <Module>.invoke_void__this___Source_TrackEventArgs (Banshee.Sources.Source,Banshee.Sources.TrackEventArgs) <IL 0x00044, 0x0005e>
at (wrapper delegate-invoke) <Module>.invoke_void__this___Source_TrackEventArgs (Banshee.Sources.Source,Banshee.Sources.TrackEventArgs) <IL 0x00059, 0x00095>
at (wrapper delegate-invoke) <Module>.invoke_void__this___Source_TrackEventArgs (Banshee.Sources.Source,Banshee.Sources.TrackEventArgs) <IL 0x00059, 0x00095>
at (wrapper delegate-invoke) <Module>.invoke_void__this___Source_TrackEventArgs (Banshee.Sources.Source,Banshee.Sources.TrackEventArgs) <IL 0x00059, 0x00095>
at (wrapper delegate-invoke) <Module>.invoke_void__this___Source_TrackEventArgs (Banshee.Sources.Source,Banshee.Sources.TrackEventArgs) <IL 0x00059, 0x00095>
at (wrapper delegate-invoke) <Module>.invoke_void__this___Source_TrackEventArgs (Banshee.Sources.Source,Banshee.Sources.TrackEventArgs) <IL 0x00059, 0x00095>
at Banshee.Sources.PrimarySource/<OnTracksChanged>c__AnonStorey21.<>m__18 () [0x0004d] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs:409
at Hyena.ThreadAssist.SpawnFromMain (System.Threading.ThreadStart) [0x00017] in /build/banshee-m7RbaM/banshee-2.2.0/src/Hyena/Hyena/Hyena/ThreadAssist.cs:112
at Banshee.Sources.PrimarySource.OnTracksChanged (Hyena.Query.QueryField[]) [0x00014] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs:398
at Banshee.Sources.PrimarySource.NotifyTracksChanged (Hyena.Query.QueryField[]) [0x00000] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs:335
at Banshee.Collection.Database.DatabaseTrackInfo.Save (bool,Hyena.Query.QueryField[]) [0x00118] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:221
at Banshee.Collection.Database.DatabaseTrackInfo.UpdateLastPlayed () [0x0000c] in /build/banshee-m7RbaM/banshee-2.2.0/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:182
at Banshee.GStreamer.PlayerEngine.OnAboutToFinish (intptr) [0x00000] in /build/banshee-m7RbaM/banshee-2.2.0/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs:384
at (wrapper native-to-managed) Banshee.GStreamer.PlayerEngine.OnAboutToFinish (intptr) <IL 0x00022, 0x0006f>

I am using the Banshee 2.2.0-1 package from Debian unstable, using Mono 2.10.1:

Mono JIT compiler version 2.10.1 (Debian 2.10.1-4)
Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            Included Boehm (with typed GC and Parallel Mark)

At the time of filing the bug against Banshee, I was using an unknown older version of both Banshee and Mono.
Comment 1 Mikayla Hutchinson [MSFT] 2011-10-20 12:31:11 UTC
This looks like a threading bug in Banshee. Some other thread is modifying the list while this thread is enumerating it, and List<T> isn't threadsafe.
Comment 2 Miguel de Icaza [MSFT] 2012-06-19 17:06:55 UTC
Updating bug status after Michael's comment.