Commit 1e41b4c
Fix part of the TSAN flakiness of ChannelTests.
#### How does the flakiness happen?
If a Dispatch I/O instance has pending dispatch_io_read, the dispatch_io_close waits for the dispatch_io_read to be completed before releasing resources. However, `[EDOSocketChannel -receiveDataWithHandler:]` does two consecutive dispatch_io_read, so the second dispatch_io_read may corrupt dispatch_io_close when TSAN is enabled.
#### Proposed Fix
In `[EDOSocketChannel -receiveDataWithHandler:]`, before performing the second dispatch_io_read, it first checks if the Dispatch I/O is still valid.
PiperOrigin-RevId: 3260863021 parent 61a4ad8 commit 1e41b4c
1 file changed
+23
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
| |||
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | | - | |
| 175 | + | |
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
| |||
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
193 | 214 | | |
0 commit comments