0002854: Music Share Watcher plugin blocks S3/S4 resume for a long period (1 Viewer)

MediaPortal-Bot

Worlds greatest bot!
March 26, 2007
3,715
180
Home Country
Germany Germany
When resuming form a standby / hibernate Music Share Plugin blocks the application message handling, causing whole system wakeup (MP only) to freeze during that period.

Depending how slow the music share location is (networks can be slow, attached log has 20 second delay. MP and PC itself are able to resume from the S3 state in a bit over 1 second and the plugin delays the wakeup 20 seconds).

private void WatchShares()
 

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Yep, there will be a threading issue:

    2010-04-17 20:44:21.413085 [Info.][MPMain(1)]: Exception :confused:ystem.InvalidOperationException: Collection was modified; enumeration operation may not execute.
    at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
    at MediaPortal.MusicShareWatcher.MusicShareWatcherHelper.WatchShares()
    at MediaPortal.MusicShareWatcher.MusicShareWatcherHelper.StartMonitor()
    at MediaPortal.MusicShareWatcher.MusicShareWatcherPlugin.OnResume()
    at MediaPortal.MusicShareWatcher.MusicShareWatcherPlugin.WndProc(Message& msg)
    2010-04-17 20:44:21.414062 [Info.][MPMain(1)]: Exception :Collection was modified; enumeration operation may not execute.
    2010-04-17 20:44:21.414062 [Info.][MPMain(1)]: site :Boolean MoveNext()
    2010-04-17 20:44:21.438476 [Info.][MPMain(1)]: source :mscorlib
    2010-04-17 20:44:21.439453 [Info.][MPMain(1)]: stacktrace: at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
    at MediaPortal.MusicShareWatcher.MusicShareWatcherHelper.WatchShares()
    at MediaPortal.MusicShareWatcher.MusicShareWatcherHelper.StartMonitor()
    at MediaPortal.MusicShareWatcher.MusicShareWatcherPlugin.OnResume()
    at MediaPortal.MusicShareWatcher.MusicShareWatcherPlugin.WndProc(Message& msg)
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    ...also the plugin is listening both events 18 / 7 events, so the second Windows event will cause the freeze:

    Code:
        private void OnResume()
        {
          lock (syncResume)
          {
            if (!_suspended)
            {
              return;
            }
    
            if (watcher != null)
            {
              Log.Info(LogType.MusicShareWatcher,
                       "Windows has resumed from standby/hibernate mode: Re-enabling file system watcher");
              watcher.StartMonitor();
            }
    
            _suspended = false;
          }
        }
     

    Users who are viewing this thread

    Top Bottom