Commit 7228e15
authored
fix: Prevent ConcurrentModificationException in cachedCandidates cache (#989)
- Store unmodifiable lists in cache to prevent modification of cached data
- Create mutable copy before retainAll() in tryQueue()
- Take snapshot of cache keys before invalidating in uncacheIfFreeing()
- Tolerate timing variation in LockStepReserveInsideLockHonouredTest
The cache stores unmodifiable lists for thread-safety since multiple
threads may read from the cache concurrently. Selective invalidation
preserves cache for unaffected queue items (important at scale with
1000+ items).
Fixes potential CI timeouts caused by thread deadlocks.1 parent 6211a74 commit 7228e15
2 files changed
Lines changed: 22 additions & 10 deletions
File tree
- src
- main/java/org/jenkins/plugins/lockableresources
- test/java/org/jenkins/plugins/lockableresources
Lines changed: 13 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
481 | 479 | | |
482 | 480 | | |
483 | 481 | | |
| |||
519 | 517 | | |
520 | 518 | | |
521 | 519 | | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
522 | 523 | | |
523 | 524 | | |
524 | 525 | | |
525 | 526 | | |
526 | 527 | | |
527 | 528 | | |
528 | 529 | | |
529 | | - | |
| 530 | + | |
| 531 | + | |
530 | 532 | | |
531 | 533 | | |
532 | 534 | | |
| |||
542 | 544 | | |
543 | 545 | | |
544 | 546 | | |
| 547 | + | |
| 548 | + | |
545 | 549 | | |
546 | 550 | | |
547 | 551 | | |
| |||
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
220 | 222 | | |
221 | | - | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
222 | 230 | | |
223 | 231 | | |
224 | 232 | | |
| |||
0 commit comments