Commit 799b897
fix(race): read result validity before Merge redeems it to the pool (#260)
validateRequiredDefinitions read red.IsValid() *after* res.Merge(red).
Merge redeems a result whose wantsRedeemOnMerge is set (true for any
pool-borrowed result) back into the process-global sync.Pool. Reading
red after that point races with a concurrent Spec() goroutine borrowing
the same *Result and calling cleared() on it.
This surfaced as a rare data race under -race in Test_ParallelPool:
Write at ... Result.cleared() <- resultsPool.BorrowResult()
Previous read ... Result.IsValid() <- validateRequiredDefinitions
Capture validity into a local before merging, matching the read-before-
merge pattern used everywhere else (e.g. validateRequiredProperties,
default/example validators).
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent e5b5ca2 commit 799b897
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
557 | 561 | | |
558 | | - | |
| 562 | + | |
559 | 563 | | |
560 | 564 | | |
561 | 565 | | |
| |||
0 commit comments