OMG!!!! Have you found a bug?? Read this! (2 Viewers)

emphatic

Design Group
  • Team MediaPortal
  • August 25, 2006
    3,717
    1,178
    Alingsås
    Home Country
    Sweden Sweden
    I have installed Titanius 1.3.0.0 in Mediaportal 1.6 and really like what I see. However, I have a strange problem. The TV button refuses to react, so I don't get ant TV menu, let alone TV :). No one else seems to be reporting this strange behaviour, but I wonder of anyone can help. Is it a bug, or am I simply missing something vital in setting it up? Log files don't appear to show anything, and a screenshot is only the main screen of Titanius.

    1. Is TV working in other skins?
    2. Did you enable the TV sub menu for the TV button or not in settings/GUI?
    If not, then try enabling the sub menu, and see if the other options work

    Emph
     

    Edwardfc

    Portal Member
    March 21, 2014
    22
    4
    78
    Gillingham, Dorset
    Home Country
    England England
    Thanks for your response.
    1. Yes, TV works in other skins: Titan, DefaultWide, etc. I have been using Mediaportal for about a year now.
    2. Yes, the TV sub menu in Titanius settings/GUI is enabled.
    3. I should have realised before, but I have identified specifically the problem area. It is when using the "Small Button"Theme. The large buttons of Titanius default work OK. The "Small Button TV" does not activate TV options.

    Edwardfc
     

    powermarcel10

    Retired Team Member
  • Premium Supporter
  • November 30, 2010
    2,839
    898
    35
    Groningen
    Home Country
    Netherlands Netherlands

    TheBatfink

    MP Donator
  • Premium Supporter
  • June 11, 2007
    1,288
    221
    Nottingham
    Home Country
    United Kingdom United Kingdom
    Hi. I'm not really sure what caused the freeze. It just so happens the last entry in the log had this error..

    Code:
    [2014-08-03 21:03:43,628] [Error  ] [DashMovies] [ERROR] - LoadSkin: Running on wrong thread - StackTrace: '   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
       at System.Environment.get_StackTrace()
       at MediaPortal.GUI.Library.GUIWindow.LoadSkin()
       at MediaPortal.GUI.Library.GUIWindow.AllocResources()
       at MediaPortal.GUI.Library.GUIWindow.DoRestoreSkin()
       at MediaPortal.GUI.Library.GUIWindowManager.GetWindow(Int32 dwID, Boolean tryRestoreSkin)
       at TraktPlugin.TraktDashboard.GetFacade(Int32 facadeID)
       at TraktPlugin.TraktDashboard.LoadTrendingMovies(Boolean forceReload)
       at TraktPlugin.TraktDashboard.<Init>b__21(Object o)
       at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.TimerQueueTimer.CallCallback()
       at System.Threading.TimerQueueTimer.Fire()
       at System.Threading.TimerQueue.FireQueuedTimerCompletion(Object state)
       at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
       at System.Threading.ThreadPoolWorkQueue.Dispatch()
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()'
    [2014-08-03 21:03:43,629] [Error  ] [DashShows] [ERROR] - LoadSkin: Running on wrong thread - StackTrace: '   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
       at System.Environment.get_StackTrace()
       at MediaPortal.GUI.Library.GUIWindow.LoadSkin()
       at MediaPortal.GUI.Library.GUIWindow.AllocResources()
       at MediaPortal.GUI.Library.GUIWindow.DoRestoreSkin()
       at MediaPortal.GUI.Library.GUIWindowManager.GetWindow(Int32 dwID, Boolean tryRestoreSkin)
       at TraktPlugin.TraktDashboard.GetFacade(Int32 facadeID)
       at TraktPlugin.TraktDashboard.LoadTrendingShows(Boolean forceReload)
       at TraktPlugin.TraktDashboard.<Init>b__23(Object o)
       at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.TimerQueueTimer.CallCallback()
       at System.Threading.TimerQueueTimer.Fire()
       at System.Threading.TimerQueue.FireNextTimers()
       at System.Threading.TimerQueue.AppDomainTimerCallback()'

    Maybe it is just co-incidence? Looking further back in the MePo error log that same error above is present a few times but I can't remember if each time a freeze occurred?

    There is also this in the Trakt log:

    Code:
    2014-08-03 17:19:56.963 [INFO] [MPMain][01]: Loading main skin window: C:\ProgramData\Team MediaPortal\MediaPortal\Skin\TITANIUS\Trakt.xml
    2014-08-03 17:20:04.061 [DEBG] [DashMovies][06]: Unable to find Facade [id:98302], check that trakt skin settings are correctly defined!
    2014-08-03 17:20:04.071 [DEBG] [DashShows][16]: Unable to find Facade [id:98301], check that trakt skin settings are correctly defined!
    2014-08-03 17:21:09.655 [DEBG] [DashShows][05]: Unable to find Facade [id:98301], check that trakt skin settings are correctly defined!
    2014-08-03 17:21:09.655 [DEBG] [DashMovies][10]: Unable to find Facade [id:98302], check that trakt skin settings are correctly defined!
    2014-08-03 20:06:23.764 [DEBG] [DashMovies][06]: Unable to find Facade [id:98302], check that trakt skin settings are correctly defined!
    2014-08-03 20:06:23.764 [DEBG] [DashShows][13]: Unable to find Facade [id:98301], check that trakt skin settings are correctly defined!
    2014-08-03 21:03:46.033 [DEBG] [DashMovies][05]: Unable to find Facade [id:98302], check that trakt skin settings are correctly defined!
    2014-08-03 21:03:46.198 [DEBG] [DashShows][10]: Unable to find Facade [id:98301], check that trakt skin settings are correctly defined!

    I also see this error below many times which appears to be movingpictures skin file related:

    Code:
    [Error  ] [MPMain   ] [ERROR] - GUIWindow:OnWindowLoaded 'C:\ProgramData\Team MediaPortal\MediaPortal\Skin\TITANIUS\movingpictures.xml' control id:19 ex:Object of type 'MediaPortal.GUI.Library.GUIImage' cannot be converted to type 'MediaPortal.GUI.Library.GUIButtonControl'.    at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
       at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
       at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, StackCrawlMark& stackMark)
       at System.Reflection.RtFieldInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
       at MediaPortal.GUI.Library.GUIWindow.OnWindowLoaded() MediaPortal.Plugins.MovingPictures.MainUI.MovingPicturesGUI
     
    Last edited:

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    @TheBatfink, the TraktPlugin will write out a stacktrace if it encounters an exception whilst trying to get the controls above. So that will explain seeing those errors. Perhaps your freeze is unrelated as you have encountered the errors before.

    Code:
    private GUIFacadeControl GetFacade(int facadeID)
      {
      int i = 0;
      GUIFacadeControl facade = null;
    
      // window init message does not work unless overridden from a guiwindow class
      // so we need to be ensured that the window is fully loaded
      // before we can get reference to a skin control
      try
      {
      do
      {
      // get current window
      var window = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow);
    
      // get facade control
      facade = window.GetControl(facadeID) as GUIFacadeControl;
      if (facade == null) Thread.Sleep(100);
    
      i++;
      }
      while (i < 50 && facade == null);
      }
      catch (Exception ex)
      {
      TraktLogger.Error("MediaPortal failed to get the active control");
      TraktLogger.Error(ex.StackTrace);
      }
    
      if (facade == null)
      {
      TraktLogger.Debug("Unable to find Facade [id:{0}], check that trakt skin settings are correctly defined!", facadeID.ToString());
      }
    
      return facade;
      }

    Most of the time it should return null and print out a debug warning to log. Best way to go forward with this is remove the setting in Trakt.SkinSettings.xml which instructs the plugin to load a dashboard on BasicHome if there is no dashboard controls defined. Otherwise ensure they are there.
     

    TheBatfink

    MP Donator
  • Premium Supporter
  • June 11, 2007
    1,288
    221
    Nottingham
    Home Country
    United Kingdom United Kingdom
    I'll pull out those references and have a play around see if the error pops up again in the logs.

    Doesn't TraktLogger write to Trakt.log? the stacktrace was in Mediaportal-error.log. If your try catch block caught the exception wouldn't there of been a line in the log "Mediaportal failed to get the active control". Seems MePo threw the exception before it got that far and your code never caught the throw and continued on to log the null reference facade id's becuase the time stamps are a few seconds later in trakt.log than the exception in Mediaportal-error.log.

    Or has MePo thrown the exception because you try to get the stracktrace on this thread?
    Code:
    LoadSkin: Running on wrong thread - StackTrace: '   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
       at System.Environment.get_StackTrace()

    As always thanks for the detailed explanation! Will hack around blindly in the skin files till Powermarcel gets a chance to look into it :)
     
    Last edited:

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    Doesn't TraktLogger write to Trakt.log? the stacktrace was in Mediaportal-error.log. If your try catch block caught the exception wouldn't there of been a line in the log "Mediaportal failed to get the active control". Seems MePo threw the exception before it got that far and your code never caught the throw and continued on to log the null reference facade id's becuase the time stamps are a few seconds later in trakt.log than the exception in Mediaportal-error.log.
    Or has MePo thrown the exception because you try to get the stracktrace on this thread?

    Good points @TheBatfink, I didn't look closely enough at your log. Yes I would expect the error to appear in the trakt log file and have that error logged before it.

    Having a look at GUIWindow.LoadSkin() method in MediaPortal source shows there is some exception handling as well which writes out a stacktrace and shows that error:

    Code:
    // add thread check to log calls not running in main thread/GUI
      String threadName = Thread.CurrentThread.Name;
      if (threadName != "MPMain" && threadName != "Config Main")
      {
      Log.Error("LoadSkin: Running on wrong thread - StackTrace: '{0}'", Environment.StackTrace);
      }

    Obviously MediaPortal does not like entering that method on another thread which indeed is what is happening when loading a dashboard in the background. I won't be changing that, what it probably should not have done is even get that far, I think from having a look at the MediaPortal code it should of returned from GUIWindowManager.GetWindow after getting the window from the dictionary (why it was not there might have something to do with it being cleared...race condition / timing related...who knows without debugging).

    In retrospect it's probably a little overkill to have that while loop in trakt trying to get a reference to the facade (if the skin doesnt have the correct skinsettings it can get stuck for 100ms * 50 = 5 secs! So very important to have skin settings defined correctly. I might look at find a better way that using that loop, even when you do have it the facade defined in the window it might loop once or twice.

    I'll presume you won't ever see this issue (or atleast very slim chance) with the controls defined in windows that the skin tells the Trakt plugin about so see how you go with that. I suspect Titan would have the same problem if users remove Trakt from BasicHome but SkinSettings is not updated.
     

    TheBatfink

    MP Donator
  • Premium Supporter
  • June 11, 2007
    1,288
    221
    Nottingham
    Home Country
    United Kingdom United Kingdom
    I had a play around and removing the trending section does stop the trakt error not finding the facades. I haven't noticed anything untoward with the skin with those lines removed from the XML so no idea what it was supposed to be doing in the first place. Hopefully @powermarcel10 knows :)

    Code:
    <trending>
    <facadetype>Filmstrip</facadetype>
    <facademaxitems>3</facademaxitems>
    <propertiesmaxitems>3</propertiesmaxitems>
    <shows>
    <windows>35</windows>
    </shows>
    <movies>
    <windows>35</windows>
    </movies>
    </trending>

    I messed around with the two versions of the XML. I was only able to replicate the exception in MePo log once and it appeared to be when closing MePo so yeah there must be some other odd condition that can happen on occasion that it doesn't like beyond simply loading basichome. I'll continue on with the modified xml and see if that exception pops up again in the future.

    Had a look in the MovingPictures skin files - not that I know what I am looking at :) and can only find id 19 in movingpictures.background XMLs. Definitely something MePo doesn't like about those controls.

    Not major things, just putting errors into MePo log and while ever they are there I can't really know for sure if it's those that are making my installation freeze up on rare occasion.

    Out of interest, why sleep the thread?
     
    Last edited:

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    I had a play around and removing the trending section does stop the trakt error not finding the facades.
    Cool, that would make sense.

    I haven't noticed anything untoward with the skin with those lines removed from the XML so no idea what it was supposed to be doing in the first place. Hopefully @powermarcel10 knows :)
    Probably copied from Titan which does show trending on BasicHome when Trakt button is selected. If the user didn't generate that button, then the same facade debug message would occur for a Titan user.

    I messed around with the two versions of the XML. I was only able to replicate the exception in MePo log once and it appeared to be when closing MePo so yeah there must be some other odd condition that can happen on occasion that it doesn't like beyond simply loading basichome. I'll continue on with the modified xml and see if that exception pops up again in the future.

    Okay, that is starting to make sense now.

    From the callstack, it looked like it didn't find the reference to the loaded window in GUIWindowManager.GetWindow()...since you were closing MediaPortal at the time, the dictionary was probably cleared as it was cleaning everything up. This may actually be reproducible now so will give it a go. It does seem harmless though as you are closing mediaportal and it doesnt invoke a crash dialog...just annoying error in logs.

    Out of interest, why sleep the thread?
    I check when the window is activated and then get the facade, for some reason MediaPortal says the facade does not exist on occasion so need to check again...I added the sleep to avoid it checking a million times before MediaPortal says here it is. I dont want that while loop or sleep so it's just there until I find a better way to get it. I personally hate it and would like to improve / refactor that code.
     

    Users who are viewing this thread

    Top Bottom