Commit 943bd93
Add LFBP Instrumentation, Server Shutdown Ordering, and Test TearDown Hardening (#1632)
* Fix dispose hang in network handler and buffer pool cleanup
Two bugs caused LimitedFixedBufferPool.Dispose() to hang indefinitely
during server teardown (blocking ClusterResetHardDuringDisklessReplicationAttach):
1. TcpNetworkHandlerBase.Dispose() never called DisposeImpl(), so when a
handler thread was blocked synchronously (e.g. in TryBeginDisklessSync),
the CTS was never cancelled and activeHandlerCount was never decremented.
DisposeActiveHandlers() would spin forever waiting for it to reach 0.
2. GarnetTcpNetworkSender.DisposeNetworkSender() disposed the saeaStack
but not the current responseObject, leaking a PoolEntry that was never
returned to the pool. LimitedFixedBufferPool.Dispose() then spun
forever waiting for totalReferences to reach 0.
Also adds PoolEntry source tracking infrastructure (PoolEntryBufferType
and PoolOwnerType enums) with DEBUG-only diagnostics that log unreturned
buffer details after a 5-second timeout during pool disposal.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* use stopwatch only in debug
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* add concurrent dictionary collection only in debug
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* reduce pool entry types to single byte
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Fix PoolEntry double-dispose in DisposeNetworkSender
Use Interlocked.Exchange to atomically take ownership of responseObject
and ReturnBuffer it back to the saeaStack before disposal. This ensures
the PoolEntry is disposed exactly once when saeaStack.Dispose() iterates
all items, and avoids a race with ReturnResponseObject() on the handler
thread that could cause Debug.Assert(!disposed) to fail.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* revert dispose calls and elevate logging for LFBP dispose timeout
* improve TearDown robustness
* propagate ownerType flag across clients
* fix ClusterReplicationCheckpointCleanupTest
* fix ClusterResetHardDuring tests by using ConfigureAwait for ExceptionInjection
* add logger for write/read asycn in device
* separate dispose from close and configure socket to allow rapid connect
* make ExceptionInjection ConfigureAwait(false)
* wip; restructuring cluster tests to reduce CI duration
* add logging for IDevice implementation
* log input to AOF for object and unified session functions
* fix ClusterSimpleFailoverAuth
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>1 parent 44da71b commit 943bd93
File tree
36 files changed
+950
-669
lines changed- benchmark/BDN.benchmark/Embedded
- libs
- client
- ClientSession
- cluster/Server
- Migration
- Replication
- PrimaryOps
- ReplicaOps
- common
- Memory
- Networking
- host
- server
- Servers
- Storage/Functions
- ObjectStore
- UnifiedStore
- storage/Tsavorite/cs/src/core/Device
- test/Garnet.test.cluster
- ReplicationTests
36 files changed
+950
-669
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
113 | 118 | | |
114 | 119 | | |
115 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
| 259 | + | |
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
| 313 | + | |
313 | 314 | | |
314 | 315 | | |
315 | 316 | | |
| |||
338 | 339 | | |
339 | 340 | | |
340 | 341 | | |
341 | | - | |
| 342 | + | |
342 | 343 | | |
343 | 344 | | |
344 | 345 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
0 commit comments