Commit 0ecb8a0
Ethan Crawford
Fix race condition in FeatureReferences<T>.Fetch
`Fetch` writes `cached = null!` to a ref field on line 103 when it
detects a revision change. This null is visible to concurrent readers
before `UpdateCached` repopulates the field, causing NRE in
`DefaultHttpRequest.set_RouteValues`.
Replace `cached = null!` + `cached ?? UpdateCached(...)` with
`(flush ? null : cached) ?? UpdateCached(...)`. When flush is true,
the ternary evaluates to `null` (a local, not a write to the ref
field), so `UpdateCached` is always called. When flush is false,
the original fast path is preserved. No null is written to the
shared ref field.
Fixes #420401 parent fe653b1 commit 0ecb8a0
1 file changed
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
104 | 102 | | |
105 | 103 | | |
106 | 104 | | |
107 | 105 | | |
108 | | - | |
| 106 | + | |
109 | 107 | | |
110 | 108 | | |
111 | 109 | | |
| |||
0 commit comments