[GH-ISSUE #1003] Service Status (in Windows Services) rapidly changes between "Starting" and "Running" and program doesn't work. #870

Closed
opened 2026-02-26 00:33:47 +03:00 by kerem · 4 comments
Owner

Originally created by @Dwedit on GitHub (Oct 12, 2020).
Original GitHub issue: https://github.com/hirschmann/nbfc/issues/1003

So, I'm setting the service rapidly switch between "Starting" and "Running" in the services manager. It's doing this every 2 seconds.

service starting service running

When I try to stop the service, I see this message:

service stopping error

Then I look at settings page, and see that it was repeatedly restarting itself on failure, and it left 4900+ events in the Event Log about being unable to start:

event viewer

Originally created by @Dwedit on GitHub (Oct 12, 2020). Original GitHub issue: https://github.com/hirschmann/nbfc/issues/1003 So, I'm setting the service rapidly switch between "Starting" and "Running" in the services manager. It's doing this every 2 seconds. ![service starting](https://i.imgur.com/1RjdbS9.png) ![service running](https://i.imgur.com/jVDbZmh.png) When I try to stop the service, I see this message: ![service stopping error](https://i.imgur.com/NlJzQ2Y.png) Then I look at settings page, and see that it was repeatedly restarting itself on failure, and it left 4900+ events in the Event Log about being unable to start: ![event viewer](https://i.imgur.com/1SQqftK.png)
kerem 2026-02-26 00:33:47 +03:00
  • closed this issue
  • added the
    Stale
    label
Author
Owner

@Dwedit commented on GitHub (Oct 12, 2020):

After running the service in a debugger, I see this exception:

System.PlatformNotSupportedException
  HResult=0x80131539
  Message=Failed to access CPU temperature sensors(s).
  Source=StagWare.Hardware
  StackTrace:
   at StagWare.Hardware.HardwareMonitor.InitializeCpuSensors()
   at StagWare.Hardware.HardwareMonitor.get_CpuTemperatures()
   at StagWare.Plugins.Generic.CpuTemperatureMonitor.GetTemperature()
   at StagWare.FanControl.FanControl.TimerCallback(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()

edit:

In this function, I see 7 sensors, all of which are type "Load" and not type "Temperature", so it sees no temperature sensors.

        private static ISensor[] GetCpuTemperatureSensors(IHardware cpu)
        {
            var sensors = new List<ISensor>();
            cpu.Update();

            foreach (ISensor s in cpu.Sensors)
            {
                if (s.SensorType == SensorType.Temperature)
                {
                    string name = s.Name.ToUpper();

                    if (name.Contains("PACKAGE") || name.Contains("TOTAL"))
                    {
                        return new ISensor[] { s };
                    }
                    else
                    {
                        sensors.Add(s);
                    }
                }
            }

            return sensors.ToArray();
        }
<!-- gh-comment-id:707375662 --> @Dwedit commented on GitHub (Oct 12, 2020): After running the service in a debugger, I see this exception: ``` System.PlatformNotSupportedException HResult=0x80131539 Message=Failed to access CPU temperature sensors(s). Source=StagWare.Hardware StackTrace: at StagWare.Hardware.HardwareMonitor.InitializeCpuSensors() at StagWare.Hardware.HardwareMonitor.get_CpuTemperatures() at StagWare.Plugins.Generic.CpuTemperatureMonitor.GetTemperature() at StagWare.FanControl.FanControl.TimerCallback(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() ``` edit: In this function, I see 7 sensors, all of which are type "Load" and not type "Temperature", so it sees no temperature sensors. ``` private static ISensor[] GetCpuTemperatureSensors(IHardware cpu) { var sensors = new List<ISensor>(); cpu.Update(); foreach (ISensor s in cpu.Sensors) { if (s.SensorType == SensorType.Temperature) { string name = s.Name.ToUpper(); if (name.Contains("PACKAGE") || name.Contains("TOTAL")) { return new ISensor[] { s }; } else { sensors.Add(s); } } } return sensors.ToArray(); } ```
Author
Owner

@Dwedit commented on GitHub (Oct 12, 2020):

It appears that "OpenHardwareMonitor" is out of date, it's 2 years behind the current version. I was able to get this working by copy-pasting in the newer Intel CPU code into "Plugins\OpenHardwareMonitor\Hardware\CPU\IntelCPU.cs"

<!-- gh-comment-id:707386946 --> @Dwedit commented on GitHub (Oct 12, 2020): It appears that "OpenHardwareMonitor" is out of date, it's 2 years behind the current version. I was able to get this working by copy-pasting in the newer Intel CPU code into "Plugins\OpenHardwareMonitor\Hardware\CPU\IntelCPU.cs"
Author
Owner

@github-actions[bot] commented on GitHub (Apr 12, 2021):

This issue is stale because it has been open more than 180 days with no activity. If nobody comments within 7 days, this issue will be closed

<!-- gh-comment-id:817396962 --> @github-actions[bot] commented on GitHub (Apr 12, 2021): This issue is stale because it has been open more than 180 days with no activity. If nobody comments within 7 days, this issue will be closed
Author
Owner

@Dwedit commented on GitHub (Apr 14, 2021):

This was caused by the program throwing an exception, then the service manager restarting it repeatedly. So this is a symptom, not the underlying bug.

<!-- gh-comment-id:819839574 --> @Dwedit commented on GitHub (Apr 14, 2021): This was caused by the program throwing an exception, then the service manager restarting it repeatedly. So this is a symptom, not the underlying bug.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nbfc-hirschmann#870
No description provided.