Commit d1c8f3b
Fix data race in includeProcessor
Added mutex protection to includeProcessor to prevent concurrent access to processingDiagnostics and fileIncludeReasons. The data race was occurring when multiple goroutines in parseTask.load() called addProcessingDiagnostic simultaneously.
Changes:
- Added mu sync.Mutex to includeProcessor struct
- Protected all reads/writes to processingDiagnostics with mutex
- Protected all reads/writes to fileIncludeReasons with mutex
- Added addFileIncludeReason() and getFileIncludeReasons() helper methods
- Updated all direct field accesses to use protected methods
- Used maps.Copy in GetIncludeReasons() as suggested by linter
Co-authored-by: jakebailey <[email protected]>1 parent 8bae50b commit d1c8f3b
File tree
4 files changed
+36
-11
lines changed- internal/compiler
4 files changed
+36
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
| 430 | + | |
435 | 431 | | |
436 | 432 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| |||
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
| 67 | + | |
| 68 | + | |
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
63 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
64 | 88 | | |
65 | 89 | | |
66 | 90 | | |
67 | | - | |
| 91 | + | |
68 | 92 | | |
69 | 93 | | |
70 | 94 | | |
| |||
74 | 98 | | |
75 | 99 | | |
76 | 100 | | |
77 | | - | |
| 101 | + | |
78 | 102 | | |
79 | 103 | | |
80 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1562 | 1562 | | |
1563 | 1563 | | |
1564 | 1564 | | |
1565 | | - | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
1566 | 1571 | | |
1567 | 1572 | | |
1568 | 1573 | | |
| |||
1578 | 1583 | | |
1579 | 1584 | | |
1580 | 1585 | | |
1581 | | - | |
| 1586 | + | |
1582 | 1587 | | |
1583 | 1588 | | |
1584 | 1589 | | |
| |||
0 commit comments