[Approved] Mantis 3277 - NetworkMonitor (1 Viewer)

OnkelChris

Retired Team Member
  • Premium Supporter
  • October 17, 2007
    764
    59
    Home Country
    Germany Germany
    Hey guys,

    I did a quick'n'dirty patch for the NetworkMonitor... attached the patch and here some line of the tv.log...


    Code:
    [TVService(6)]: NetworkMonitorHandler: networkMonitor started
    [TVService(6)]: NetworkMonitorHandler: idle limit in KB/s: 75
    .
    .
    .
    [PowerScheduler poll thread(14)]: NetworkMonitorHandler: standby prevented: Atheros AR9285 Wireless Network Adapter
    [PowerScheduler poll thread(14)]: NetworkMonitorHandler: ulSpeed: 65
    [PowerScheduler poll thread(14)]: NetworkMonitorHandler: dlSpeed: 3039
    [PowerScheduler poll thread(14)]: PowerScheduler: User input detected at 08.01.2011 14:37:11
    [PowerScheduler poll thread(14)]: PowerScheduler.DisAllowShutdown: inspecting handler:NetworkMonitorHandler DisAllowShutdown:True
    [PowerScheduler poll thread(14)]: PowerScheduler: System changed from idle state to busy state

    perhaps this helps some devs?

    what i found by searching around: (comment in the reference source for PerformanceCounterLib.GetData)

    // Win32 RegQueryValueEx for perf data could deadlock (for a Mutex) up to 2mins in some
    // scenarios before they detect it and exit gracefully. In the mean time, ERROR_BUSY,
    // ERROR_NOT_READY etc can be seen by other concurrent calls (which is the reason for the
    // wait loop and switch case below). We want to wait most certainly more than a 2min window.
    // The curent wait time of up to 10mins takes care of the known stress deadlock issues. In most
    // cases we wouldn't wait for more than 2mins anyways but in worst cases how much ever time
    // we wait may not be sufficient if the Win32 code keeps running into this deadlock again
    // and again. A condition very rare but possible in theory. We would get back to the user
    // in this case with InvalidOperationException after the wait time expires.
     

    Attachments

    • PS_mantis_3277_w_logging.patch
      3.2 KB

    OnkelChris

    Retired Team Member
  • Premium Supporter
  • October 17, 2007
    764
    59
    Home Country
    Germany Germany
    AW: Mantis 3277 - NetworkMonitor

    hmmm... 17 times downloaded... no feedback? in my environment it's working without side effects... someone with other experiences?
     

    robyf

    Retired Team Member
  • Premium Supporter
  • June 20, 2005
    1,076
    278
    54
    Bolzano
    Home Country
    Italy Italy
    Sorry didn't intended this one was the final path... Will try and report.
     

    OnkelChris

    Retired Team Member
  • Premium Supporter
  • October 17, 2007
    764
    59
    Home Country
    Germany Germany
    AW: Mantis 3277 - NetworkMonitor

    final from my side, until there is a bit feedback ;)
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Since there is code moved to a nex thread make sure that the thread function is catching errors. If there is no error handling in the thread function then it will cause the application (tve3 in this case) to crash completely if some part of the code throws an error.

    Code:
        private void StartNetworkMonitor()
        {
          monitoredAdapters.Clear();
    
    ...
    
        private void StartNetworkMonitor()
        {
          try
         {
            monitoredAdapters.Clear();
            ...
         }
         catch (Exception ex)
         {
          // at least log the error, better if handled properly
         }
     

    OnkelChris

    Retired Team Member
  • Premium Supporter
  • October 17, 2007
    764
    59
    Home Country
    Germany Germany
    AW: Mantis 3277 - NetworkMonitor

    tourettes:
    u are right... but hey, I called it quick'n'dirty :p

    first post updated with "new" patch... looks like the whole thing is rewritten, but I just added the "try{}catch{}" for logging an error. So if someone is already testing the first patch, there is no need for the new patch, as it does the same + logging errors!
     

    disaster123

    MP Donator
  • Premium Supporter
  • May 14, 2008
    3,558
    434
    Home Country
    Germany Germany
    AW: Mantis 3277 - NetworkMonitor

    works fine here this patch
     

    Users who are viewing this thread

    Top Bottom