Commit 83b2600
committed
Add diagnostic logging to MemoryJournal to track lock contention
Added comprehensive telemetry to investigate intermittent test failures in
InMemoryEventsByTagSpec.ReadJournal_live_query_EventsByTag_should_find_events_from_offset_exclusive.
Changes:
- Added Stopwatch-based timing instrumentation to track lock acquisition wait times in WriteMessagesAsync and ReplayTaggedMessagesAsync
- Added DEBUG logging for all journal message types (ReplayTaggedMessages, ReplayAllEvents, SelectCurrentPersistenceIds)
- Logs thread IDs, lock wait times, lock hold times, and event counts
- Enabled DEBUG log level in InMemoryEventsByTagSpec test configuration
Diagnostic output includes:
- "[DIAG] WriteMessagesAsync called on thread X, attempting to acquire lock"
- "[DIAG] Lock acquired after Xms on thread Y"
- "[DIAG] Lock released after holding for Xms"
- "[DIAG] Wrote event for {persistenceId}, seq {seqNr}, total events: {count}"
- "[DIAG] ReplayTaggedMessages lock acquired after Xms"
- "[DIAG] Found X events matching tag 'Y'"
This instrumentation will capture timing data on CI/CD build servers to determine
if the test failures are caused by:
1. Lock contention/fairness issues with Monitor
2. Thread pool starvation
3. Async execution context delays
4. RecoveryPermitter bottlenecks
All diagnostic logging uses [DIAG] prefix for easy filtering. These changes are
temporary for diagnosis and will be reverted once root cause is identified.1 parent efb2113 commit 83b2600
File tree
2 files changed
+39
-1
lines changed- src
- contrib/persistence/Akka.Persistence.Query.InMemory.Tests
- core/Akka.Persistence/Journal
2 files changed
+39
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
46 | 51 | | |
47 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
48 | 57 | | |
49 | 58 | | |
50 | 59 | | |
| |||
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
63 | 77 | | |
64 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
65 | 83 | | |
66 | 84 | | |
67 | 85 | | |
| |||
219 | 237 | | |
220 | 238 | | |
221 | 239 | | |
| 240 | + | |
222 | 241 | | |
223 | 242 | | |
224 | 243 | | |
225 | 244 | | |
226 | 245 | | |
| 246 | + | |
| 247 | + | |
227 | 248 | | |
228 | 249 | | |
229 | 250 | | |
230 | 251 | | |
231 | 252 | | |
| 253 | + | |
| 254 | + | |
232 | 255 | | |
233 | 256 | | |
234 | 257 | | |
| |||
258 | 281 | | |
259 | 282 | | |
260 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
261 | 289 | | |
262 | 290 | | |
263 | 291 | | |
264 | 292 | | |
265 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
266 | 298 | | |
267 | 299 | | |
268 | 300 | | |
| |||
271 | 303 | | |
272 | 304 | | |
273 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
274 | 309 | | |
275 | 310 | | |
276 | 311 | | |
277 | 312 | | |
278 | 313 | | |
279 | 314 | | |
280 | 315 | | |
| 316 | + | |
| 317 | + | |
281 | 318 | | |
282 | 319 | | |
283 | 320 | | |
| 321 | + | |
284 | 322 | | |
285 | 323 | | |
286 | 324 | | |
| |||
0 commit comments