我正在研究客户的核心转储。因此,我将无法共享导致错误的代码片段。不过,我希望有人会有一些提示如何继续下去。
我有一个通过套接字进行通信的应用程序。它会打开多个客户端的连接数。经过一段时间后,它会因OutOfMemoryException而失败,即使服务器上有足够的内存且进程不超过32位的限制。
来自核心转储的线程池状态如下所示:
!ThreadPool
CPU utilization: 17%
Worker Thread: Total: 16 Running: 0 Idle: 16 MaxLimit: 1023 MinLimit: 16
Work Request in Queue: 0
--------------------------------------
Number of Timers: 2
--------------------------------------
Completion Port Thread:Total: 29 Free: 0 MaxFree: 32 CurrentLimit: 29
MaxLimit: 1000 MinLimit: 16
29个完成端口线程中的大多数抛出OutOfMemoryException。
部分内容!线程输出如下所示:
0 1 1c548 00390680 2026020 Preemptive 00000000:00000000 0038a7f0 0 STA
2 2 2b770 0039db70 2b220 Preemptive 00000000:00000000 0038a7f0 0 MTA (Finalizer)
6 3 2c080 003ef588 a029220 Preemptive 00000000:00000000 0038a7f0 0 MTA (Threadpool Completion Port)
7 4 22ae4 004067e0 202b020 Preemptive 0F0905F0:00000000 0038a7f0 0 MTA
11 5 1ba94 03a79358 a029220 Preemptive 00000000:00000000 03a99928 0 MTA (Threadpool Completion Port)
12 6 3105c 03a7c138 a029220 Preemptive 00000000:00000000 03a99928 0 MTA (Threadpool Completion Port) System.OutOfMemoryException 016c4bc8
13 7 250f0 03a7c958 a029220 Preemptive 0F5B50BC:00000000 03a99928 0 MTA (Threadpool Completion Port) System.OutOfMemoryException 00ef70fc
14 8 32d9c 03a7d578 a029220 Preemptive 00000000:00000000 03a99928 0 MTA (Threadpool Completion Port) System.OutOfMemoryException 016c896c
15 9 3281c 03a7dd98 a029220 Preemptive 00000000:00000000 03a99928 0 MTA (Threadpool Completion Port) System.OutOfMemoryException 016c2f2c
16 10 1c360 03a7e7c0 a029220 Preemptive 00000000:00000000 03a99928 0 MTA (Threadpool Completion Port) System.OutOfMemoryException 016bc434
17 11 240ac 03a815f0 a029220 Preemptive 00000000:00000000 03a99928 0 MTA (Threadpool Completion Port) System.OutOfMemoryException 016bb198
18 12 250fc 03a8fcd0 21220 Preemptive 00000000:00000000 0038a7f0 0 Ukn
19 13 30f1c 03ab4fb0 102a220 Preemptive 00000000:00000000 0038a7f0 0 MTA (Threadpool Worker)
20 14 1a034 03ae9210 202b020 Preemptive 0F625BB8:00000000 03a99928 0 MTA
21 15 1f3bc 03ae49b8 202b220 Preemptive 00000000:00000000 03a99928 1 MTA
22 16 f8d8 03aba8c8 202b020 Preemptive 00000000:00000000 03a99928 0 MTA
23 17 32808 03b10118 a029220 Preemptive 00000000:00000000 03a99928 0 MTA (Threadpool Completion Port) System.OutOfMemoryException 016bb760
24 18 2ee1c 03b0fbd0 a029220 Preemptive 00000000:00000000 03a99928 0 MTA (Threadpool Completion Port) System.OutOfMemoryException 016bc268
25 19 539c 03b0ebf8 a029220 Preemptive 00000000:00000000 03a99928 0 MTA (Threadpool Completion Port) System.OutOfMemoryException 016c6288
26 20 31be8 03b0f140 202b220 Preemptive 00000000:00000000 03a99928 1 MTA
27 21 2e884 03b10660 202b220 Preemptive 00000000:00000000 03a99928 1 MTA
28 22 10934 03b0f688 202b220 Preemptive 00000000:00000000 03a99928 1 MTA
对我而言,它看起来像一个僵局,消费者停止处理数据进入套接字,但这只是一个模糊的理论。
你对此有什么想法吗?
答案 0 :(得分:0)
你提到了x86。由于旧的决定,x86 .NET应用程序仅限于使用用户模式虚拟地址空间的2 GiB RAM: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366778.aspx#memory_limits
使用IMAGE_FILE_LARGE_ADDRESS_AWARE
可以将限制增加到3甚至4 GiB还有其他的.NET内存管理怪癖和衡量你应该注意的事项: