ThreadPool不启动任何新线程,但低于极限
我有一个使用异步任务从MQTT服务器获取数据的应用程序。 将系统更新为Windows 11后,我开始注意到问题是在应用程序运行几天后没有启动的异步任务。 这在我从Windows 10到Windows 11上升之前工作正常。 在检查调试器时,我注意到ThreadPool设置为至少16个任务,但目前只有1个任务女巫正在等待其他未启动的任务。 我还用windbg检查了一个转储,并从!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
我的代码基本上是基本的
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
,现在我将startupmqtt()。等待()更改为startupmqtt()。等待(5000),但是我必须等待解决问题,如果解决问题了整个应用程序悬挂。
除了我的更改之外,我可以尝试防止这种情况发生/冻结应用程序吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论