Hello everyone,
I’m troubleshooting an asp.net mvc web application configured to use Couchbase as a custom SessionStateProvider. The CouchbaseNetClient version used is 2.7.22 and the CouchbaseSessionStateProvider class has been based on this version.
I took several dumps from the w3wp.exe process (Win2k22 Datacenter) at different moments (low / medium / high memory usage) and I noticed a spike in System.Byte arrays.
At 2Gb of memory used => Count: 91,932 TotalSize: 889 Mb System.Byte[]
At 4Gb of memory used => Count: 102,532 TotalSize: 1Gb System.Byte[]
At 10Gb of memory used => Count: 134,765 TotalSize: 3.4Gb System.Byte[]
I checked the dump files taken at these moments in WindbgPreview:
- !dumpheap -stat
MT | Count | TotalSize | Class Name |
---|---|---|---|
00007ff87a4267d0 | 56,390 | 225,109,502 | System.Char[] |
00007ff87a4259c0 | 1,500,309 | 870,872,408 | System.String |
00007ff87a42aaa0 | 134,765 | 3,463,725,185 | System.Byte[] |
- !DumpHeap /d -mt 00007ff87a42aaa0 gave me all 134,765 System.Byte
[]
entries, ant the largest one had 67Mb as can be seen below:
Address | MT | Size |
---|---|---|
00000206bc8ceb10 | 00007ff87a42aaa0 | 67,108,888.00 |
-
!gcroot 00000206bc8ceb10 gave the Thread holding a reference the 67Mb
-> 0000020279b99f88 SessionStateV2.CouchbaseSessionStateProvider -> 0000020177878300 Couchbase.CouchbaseBucket -> 00000202775ec048 Couchbase.Core.ClusterController -> 00000202775ec1b0 System.Collections.Concurrent.ConcurrentDictionary`2[[System.String, mscorlib],[Couchbase.Core.IBucket, Couchbase.NetClient]] -> 00000202775ec450 System.Collections.Concurrent.ConcurrentDictionary`2+Tables[[System.String, mscorlib],[Couchbase.Core.IBucket, Couchbase.NetClient]] -> 00000202775ec340 System.Collections.Concurrent.ConcurrentDictionary`2+Node[[System.String, mscorlib],[Couchbase.Core.IBucket, Couchbase.NetClient]][] -> 00000200f7e07410 System.Collections.Concurrent.ConcurrentDictionary`2+Node[[System.String, mscorlib],[Couchbase.Core.IBucket, Couchbase.NetClient]] -> 00000200f7e070d8 Couchbase.CouchbaseBucket -> 00000203776b4bd8 Couchbase.Configuration.CouchbaseConfigContext -> 00000200f7d97cc0 Couchbase.Core.Buckets.VBucketKeyMapper -> 00000200f7d97d08 System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib],[Couchbase.Core.IVBucket, Couchbase.NetClient]] -> 00000200f7df9420 System.Collections.Generic.Dictionary`2+Entry[[System.Int32, mscorlib],[Couchbase.Core.IVBucket, Couchbase.NetClient]][] -> 00000200f7d97d78 Couchbase.Core.VBucket -> 00000200f7d954a0 System.Collections.Generic.Dictionary`2[[System.Net.IPEndPoint, System],[Couchbase.Core.IServer, Couchbase.NetClient]] -> 00000200f7d95518 System.Collections.Generic.Dictionary`2+Entry[[System.Net.IPEndPoint, System],[Couchbase.Core.IServer, Couchbase.NetClient]][] -> 00000200f7d7e428 Couchbase.Core.Server -> 000002017797d640 Couchbase.IO.Services.SharedPooledIOService -> 000002017797d4d0 Couchbase.IO.SharedConnectionPool`1[[Couchbase.IO.MultiplexingConnection, Couchbase.NetClient]] -> 000002017797d568 System.Collections.Generic.List`1[[Couchbase.IO.IConnection, Couchbase.NetClient]] -> 00000200778e5408 Couchbase.IO.IConnection[] -> 00000200f8d24788 Couchbase.IO.MultiplexingConnection -> 00000206bc8ceb10 System.Byte[]
As we can see the MultiplexingConnection at 00000200f8d24788 is holding a System.Byte[]
array of 67 Mb and that grabbed my attention …
I can see via !DumpObj 00000200f8d24788 a _receiveBuffer that’s holding that amount of the 67Mb of memory
00007ff87a426a10 40003a6 a8 ....Threading.Thread 0 instance 00000200f8d24ec0 _receiveThread
00007ff87a42aaa0 40003a7 b0 System.Byte[] 0 instance 00000206bc8ceb10 _receiveBuffer
00007ff87a4285a0 40003a8 c0 System.Int32 1 instance 0 _receiveBufferLength
00007ff87a425dd8 40003a9 b8 System.Object 0 instance 00000200f8d24858 _syncObj
I saw a previous post here were the user @ btburnett3 mentions this buffer.
Why this buffer is not being wiped out?
Thank you very much!
–marcos