'Threadpool not starting any new threads, but is below limit
I have a app that uses async tasks to get Data from a MQTT server. After I updated my System to Windows 11 I started noticing the Problem that the async tasks are not starting after the App runs for some Days. This Worked fine before I upraded from Windows 10 to Windows 11. Checking with a Debugger, I noticed that the Threadpool is set to minimum 16 tasks, but currently only has 1 task witch is waiting for another tasks that is not starting. I also checked a Dump with Windbg and got this Result from !ThreadPool
CPU utilization: 9%
Worker Thread: Total: 1 Running: 0 Idle: 1 MaxLimit: 32767 MinLimit: 16
Work Request in Queue: 0
--------------------------------------
Number of Timers: 1
--------------------------------------
Completion Port Thread:Total: 1 Free: 1 MaxFree: 32 CurrentLimit: 1 MaxLimit: 1000 MinLimit: 16
My Code is basicly
Sub Test()
StartUpMQTT().Wait()
End Sub
Private Async Function StartUpMQTT() As Task
MQTTClient = Await Net.Mqtt.MqttClient.CreateAsync(strWebLink, Configuration) 'This is the Line where it waits for the unstarted task.
sessionState = Await MQTTClient.ConnectAsync(New MqttClientCredentials("TestAuslesung"))
End function
For now I changed my StartUpMQTT().Wait() to StartUpMQTT().Wait(5000), but I have to wait if this solves the issue of the whole app hanging.
Anything I can try to prevent this from happening/freezing the app, other than my change?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|