gpt4 book ai didi

c# - 使用 WinDbg 和 SOS 调试挂起的 .net 应用程序、死锁或失控线程?

转载 作者:行者123 更新时间:2023-12-02 20:03:44 26 4
gpt4 key购买 nike

我正在使用 WinDbg 和 SOS 来调试挂起的 .NET 应用程序(应用程序关闭后保留在 TaskManager 中)。当我执行 !threads 命令时,我得到以下输出。它仅显示一个线程的锁定计数 = 1。

0:002> !threads
ThreadCount: 132
UnstartedThread: 2
BackgroundThread: 54
PendingThread: 0
DeadThread: 48
Hosted Runtime: no
Lock
ID OSID ThreadOBJ State GC Mode GC Alloc Context Domain Count Apt Exception
0 1 13010 000002716ae37680 2036220 Preemptive 00000271060C1958:00000271060C36E8 000002716ae2afd0 0 STA
2 2 106e4 000002716ae63220 2b220 Preemptive 0000027105FB9778:0000027105FBB6E8 000002716ae2afd0 0 MTA (Finalizer)
XXXX 3 0 000002716d1b8360 8039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Completion Port)
XXXX 4 0 000002716d1ca8b0 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
7 5 14570 000002716d23e290 3029220 Preemptive 0000027105FF1D08:0000027105FF36E8 000002716ae2afd0 0 MTA (Threadpool Worker)
10 7 14c54 000002716d85ddc0 102a220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA (Threadpool Worker)
12 8 12758 000002716d8b56a0 202b220 Preemptive 00000271060457C8:00000271060476E8 000002716ae2afd0 1 MTA
XXXX 9 0 000002716d8795d0 8039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Completion Port)
13 10 12ef8 000002716d8b95d0 1020220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
15 11 11e04 000002716d8d21c0 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
16 12 14b30 000002716d8dbd50 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
17 14 14760 000002716d819c30 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
XXXX 15 0 000002716d21c7a0 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
18 16 143e8 0000027170b91780 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
19 17 13b9c 0000027170ba5800 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
20 18 11278 0000027170bb8600 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
21 19 14608 000002716d805310 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
22 20 131f8 000002716d8e0830 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
23 21 14a54 000002716d8e1000 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
24 22 13d78 000002716d8e1fa0 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
25 23 10da8 000002716d8de8f0 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
26 24 137c4 0000027170b99a90 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
27 25 12580 0000027170b9a260 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
28 26 14388 0000027170b9aa30 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
29 27 12390 0000027170b95440 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
30 28 f5b4 0000027170b9b200 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
31 29 fde8 0000027170b963e0 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
32 30 13114 0000027170b97380 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
33 31 14068 0000027170b98320 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
34 32 14a38 0000027170ba7790 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
35 33 1391c 0000027170ba67f0 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
36 34 13a64 0000027170ba6fc0 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
37 35 f764 0000027170bac5b0 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
38 36 f818 0000027170baae40 1029220 Preemptive 0000027106299D48:000002710629B6E8 000002716ae2afd0 0 MTA (Threadpool Worker)
39 37 14738 0000027170bacd80 1029220 Preemptive 0000027106275548:00000271062756E8 000002716ae2afd0 0 MTA (Threadpool Worker)
XXXX 38 0 0000027170ba7f60 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
40 39 1232c 0000027170ba6020 3029220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA (Threadpool Worker)
XXXX 40 0 0000027170db57e0 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 41 0 0000027170db5010 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 42 0 0000027170db7720 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
42 43 14d6c 0000027170db4840 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
43 44 13d70 0000027170db1960 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
XXXX 45 0 0000027170db2130 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 46 0 0000027170db4070 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 47 0 00000271731b4650 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
44 48 60ec 00000271731b0fa0 2b020 Preemptive 000002710617F738:00000271061816E8 000002716ae2afd0 0 MTA
45 49 132d8 00000271731b36b0 202b020 Preemptive 000002710617D738:000002710617F6E8 000002716ae2afd0 0 MTA
46 50 134cc 00000271731b1770 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
47 51 14028 00000271731b2ee0 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
XXXX 52 0 00000271731b3e80 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 53 0 00000271731b1f40 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
48 54 14bf0 00000271731b07d0 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
49 55 1147c 00000271731c8800 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
50 56 1467c 00000271731c8030 2b020 Preemptive 0000027106185738:00000271061876E8 000002716ae2afd0 0 MTA
51 57 14148 00000271731cbeb0 202b020 Preemptive 0000027106183738:00000271061856E8 000002716ae2afd0 0 MTA
52 58 14574 00000271731cc680 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
53 59 12444 00000271731c5920 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
XXXX 60 0 00000271731c7090 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 61 0 00000271731c8fd0 9600 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 62 0 00000271731c7860 9600 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
54 63 14904 00000271731c97a0 202b220 Preemptive 0000027106359808:000002710635B6E8 000002716ae2afd0 0 MTA
55 64 12920 00000271731f67c0 2b020 Preemptive 000002710634F700:00000271063516E8 000002716ae2afd0 0 MTA
56 65 14e54 00000271731f5050 202b020 Preemptive 0000027106189738:000002710618B6E8 000002716ae2afd0 0 MTA
57 66 14e34 00000271731fb5e0 202b020 Preemptive 0000027106354F28:00000271063556E8 000002716ae2afd0 0 MTA
58 67 11d88 00000271731fa640 202b020 Preemptive 00000271060797D8:000002710607B6E8 000002716ae2afd0 0 MTA
XXXX 68 0 00000271731fae10 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
60 69 12d2c 00000271731fbdb0 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
XXXX 70 0 00000271731f9e70 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
59 71 12e5c 00000271731f8ed0 2b020 Preemptive 0000027106193738:00000271061956E8 000002716ae2afd0 0 MTA
61 72 14a94 000002717320c730 202b020 Preemptive 0000027106191738:00000271061936E8 000002716ae2afd0 0 MTA
62 73 fd58 0000027173213f70 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
63 74 13858 0000027173212030 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
64 75 ef34 00000271732185c0 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
XXXX 76 0 00000271732156e0 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
65 77 fd9c 0000027173216680 202b220 Preemptive 0000027106094C80:00000271060956E8 000002716ae2afd0 0 MTA
66 78 129a4 0000027173217620 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
XXXX 79 0 0000027173211090 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
67 80 13120 0000027173209080 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
68 81 147ec 000002717320fde0 202b220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
XXXX 82 0 000002717320a7f0 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
69 83 12720 000002717320bf60 2b020 Preemptive 000002710619D738:000002710619F6E8 000002716ae2afd0 0 MTA
70 84 f42c 000002717320cf00 2b020 Preemptive 0000027106199738:000002710619B6E8 000002716ae2afd0 0 MTA
71 85 148a0 000002717320ee40 2b020 Preemptive 00000271061A1738:00000271061A36E8 000002716ae2afd0 0 MTA
72 86 14f50 000002717320dea0 202b020 Preemptive 0000027106197738:00000271061996E8 000002716ae2afd0 0 MTA
73 87 14690 000002717320e670 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
74 88 13dd0 0000027173256850 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
75 89 13adc 0000027173257020 202b020 Preemptive 000002710619B738:000002710619D6E8 000002716ae2afd0 0 MTA
76 90 13668 0000027173254910 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
77 91 14d78 0000027173258f60 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
78 92 12f54 00000271732558b0 202b020 Preemptive 000002710619F738:00000271061A16E8 000002716ae2afd0 0 MTA
79 93 13e38 0000027173252200 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
80 94 14938 0000027173251a30 202b020 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 MTA
XXXX 95 0 000002717325a6d0 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
81 96 14064 000002717325aea0 27220 Preemptive 0000027106361B90:00000271063636E8 000002716ae2afd0 0 STA
82 97 11fb8 000002717325c610 27220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 STA
XXXX 98 0 000002717325d5b0 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
83 99 13580 000002717325e550 8029220 Preemptive 00000271062F4B28:00000271062F56E8 000002716ae2afd0 0 MTA (Threadpool Completion Port)
XXXX 100 0 0000027173258790 8039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Completion Port)
8 101 7e2c 000002717325fcc0 20220 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 102 0 000002717325dd80 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 103 0 0000027173260490 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 104 0 000002716aea61b0 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 105 0 000002717343f830 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 106 0 0000027173440000 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
84 107 13848 0000027173444650 1029220 Preemptive 00000271062F2720:00000271062F36E8 000002716ae2afd0 0 MTA (Threadpool Worker)
XXXX 108 0 0000027173440fa0 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 109 0 0000027173441f40 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 110 0 0000027173442710 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 111 0 0000027173444e20 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 112 0 00000271734484d0 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 113 0 0000027173448ca0 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 114 0 0000027173446d60 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 115 0 0000027173447530 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
85 116 13ec8 0000027173449470 1029220 Preemptive 000002710624CFB8:000002710624D6E8 000002716ae2afd0 0 MTA (Threadpool Worker)
XXXX 117 0 00000271734436b0 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 118 0 0000027173447d00 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 119 0 000002717344dac0 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
86 120 137a8 000002717344c350 1029220 Preemptive 0000027106258D60:00000271062596E8 000002716ae2afd0 0 MTA (Threadpool Worker)
XXXX 121 0 000002717344d2f0 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 122 0 0000027173326f50 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
XXXX 123 0 0000027173327ef0 1039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Worker)
87 124 1443c 00000271733286c0 1029220 Preemptive 000002710631AEF8:000002710631B6E8 000002716ae2afd0 0 MTA (Threadpool Worker)
88 125 13b98 0000027173329660 1029220 Preemptive 0000027106256958:00000271062576E8 000002716ae2afd0 0 MTA (Threadpool Worker)
XXXX 13 0 000002717332bd70 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 126 0 000002717332d4e0 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 127 0 00000271733332a0 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 128 0 0000027173331b30 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 129 0 0000027173332300 39820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn
XXXX 6 0 000002717332f420 8039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Completion Port)
XXXX 131 0 000002717332e480 8039820 Preemptive 0000000000000000:0000000000000000 000002716ae2afd0 0 Ukn (Threadpool Completion Port)
89 130 1404c 0000027173332ad0 8029220 Preemptive 0000027106334438:00000271063356E8 000002716ae2afd0 0 MTA (Threadpool Completion Port)
90 132 14cbc 000002717332dcb0 8029220 Preemptive 000002710635C790:000002710635D6E8 000002716ae2afd0 0 MTA (Threadpool Completion Port)

当我执行 !syncblk 时,我得到以下输出,我相信它告诉我没有线程拥有任何监视器:

0:002> !syncblk
Index SyncBlock MonitorHeld Recursion Owning Thread Info SyncBlock Owner
-----------------------------
Total 351
CCW 49
RCW 15
ComClassFactory 0
Free 35

当我切换到显示锁的线程时,我看到以下内容:

0:002> ~12s
ntdll!NtWaitForMultipleObjects+0x14:
00007ffe`7b5b6c24 c3 ret

当我执行 !runaway 时,我有这个:

 0:000> !runaway
User Mode Time
Thread Time
0:13010 0 days 0:00:16.203
6:e444 0 days 0:00:01.687
81:14064 0 days 0:00:00.281
40:1232c 0 days 0:00:00.234
16:14b30 0 days 0:00:00.125
32:13114 0 days 0:00:00.078
65:fd9c 0 days 0:00:00.062
39:14738 0 days 0:00:00.062
67:13120 0 days 0:00:00.046
38:f818 0 days 0:00:00.046
54:14904 0 days 0:00:00.031
7:14570 0 days 0:00:00.031
87:1443c 0 days 0:00:00.015
58:11d88 0 days 0:00:00.015
48:14bf0 0 days 0:00:00.015
44:60ec 0 days 0:00:00.015
42:14d6c 0 days 0:00:00.015
27:12580 0 days 0:00:00.015
15:11e04 0 days 0:00:00.015
2:106e4 0 days 0:00:00.015
91:149e8 0 days 0:00:00.000
90:14cbc 0 days 0:00:00.000
89:1404c 0 days 0:00:00.000
88:13b98 0 days 0:00:00.000
86:137a8 0 days 0:00:00.000
85:13ec8 0 days 0:00:00.000
84:13848 0 days 0:00:00.000
83:13580 0 days 0:00:00.000
82:11fb8 0 days 0:00:00.000
80:14938 0 days 0:00:00.000
79:13e38 0 days 0:00:00.000
78:12f54 0 days 0:00:00.000
77:14d78 0 days 0:00:00.000
76:13668 0 days 0:00:00.000
75:13adc 0 days 0:00:00.000
74:13dd0 0 days 0:00:00.000
73:14690 0 days 0:00:00.000
72:14f50 0 days 0:00:00.000
71:148a0 0 days 0:00:00.000
70:f42c 0 days 0:00:00.000
69:12720 0 days 0:00:00.000
68:147ec 0 days 0:00:00.000
66:129a4 0 days 0:00:00.000
64:ef34 0 days 0:00:00.000
63:13858 0 days 0:00:00.000
62:fd58 0 days 0:00:00.000
61:14a94 0 days 0:00:00.000
60:12d2c 0 days 0:00:00.000
59:12e5c 0 days 0:00:00.000
57:14e34 0 days 0:00:00.000
56:14e54 0 days 0:00:00.000
55:12920 0 days 0:00:00.000
53:12444 0 days 0:00:00.000
52:14574 0 days 0:00:00.000
51:14148 0 days 0:00:00.000
50:1467c 0 days 0:00:00.000
49:1147c 0 days 0:00:00.000
47:14028 0 days 0:00:00.000
46:134cc 0 days 0:00:00.000
45:132d8 0 days 0:00:00.000
43:13d70 0 days 0:00:00.000
41:14504 0 days 0:00:00.000
37:f764 0 days 0:00:00.000
36:13a64 0 days 0:00:00.000
35:1391c 0 days 0:00:00.000
34:14a38 0 days 0:00:00.000
33:14068 0 days 0:00:00.000
31:fde8 0 days 0:00:00.000
30:f5b4 0 days 0:00:00.000
29:12390 0 days 0:00:00.000
28:14388 0 days 0:00:00.000
26:137c4 0 days 0:00:00.000
25:10da8 0 days 0:00:00.000
24:13d78 0 days 0:00:00.000
23:14a54 0 days 0:00:00.000
22:131f8 0 days 0:00:00.000
21:14608 0 days 0:00:00.000
20:11278 0 days 0:00:00.000
19:13b9c 0 days 0:00:00.000
18:143e8 0 days 0:00:00.000
17:14760 0 days 0:00:00.000
14:13e34 0 days 0:00:00.000
13:12ef8 0 days 0:00:00.000
12:12758 0 days 0:00:00.000
11:13e40 0 days 0:00:00.000
10:14c54 0 days 0:00:00.000
9:13e98 0 days 0:00:00.000
8:7e2c 0 days 0:00:00.000
5:14b18 0 days 0:00:00.000
4:14a48 0 days 0:00:00.000
3:12da4 0 days 0:00:00.000
1:14fd8 0 days 0:00:00.000

我不是 WinDbg 或 SOS 方面的专家,但有人可以帮我解释一下吗?我认为问题不是死锁,而可能是线程失控。我该如何继续。我被困在这一点上。

谢谢!

最佳答案

该列表中有很多前台线程,并且任何仍在运行的前台线程都会阻止 CLR 关闭,即使应用程序没有任何可见窗口(根据 Microsoft 的 docs) .

可以通过 !ThreadState 命令来判断哪些不是后台,例如:

0:000> !threadstate 2b020
Legal to Join
CLR Owns
CoInitialized
In Multi Threaded Apartment
Fully initialized

使用 !threads 输出的 State 列中的值作为参数。

返回列表,所有状态为 2b020 或 202b020 的线程都是前台。检查它们的堆栈,将它们与您在代码中创建它们的位置联系起来。

创建它们时,通过将 IsBackground 属性设置为 true 将它们设置为背景。更好的是,不要创建它们。这是一个很好的替代方案列表:Background Thread? Let me count the ways....

关于c# - 使用 WinDbg 和 SOS 调试挂起的 .net 应用程序、死锁或失控线程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55210793/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com