Commit 2f8abb4
[SPARK-13122] Fix race condition in MemoryStore.unrollSafely()
https://issues.apache.org/jira/browse/SPARK-13122
A race condition can occur in MemoryStore's unrollSafely() method if two threads that
return the same value for currentTaskAttemptId() execute this method concurrently. This
change makes the operation of reading the initial amount of unroll memory used, performing
the unroll, and updating the associated memory maps atomic in order to avoid this race
condition.
Initial proposed fix wraps all of unrollSafely() in a memoryManager.synchronized { } block. A cleaner approach might be introduce a mechanism that synchronizes based on task attempt ID. An alternative option might be to track unroll/pending unroll memory based on block ID rather than task attempt ID.
Author: Adam Budde <[email protected]>
Closes #11012 from budde/master.
(cherry picked from commit ff71261)
Signed-off-by: Andrew Or <[email protected]>
Conflicts:
core/src/main/scala/org/apache/spark/storage/MemoryStore.scala1 parent e81333b commit 2f8abb4
File tree
1 file changed
+9
-5
lines changed- core/src/main/scala/org/apache/spark/storage
1 file changed
+9
-5
lines changedLines changed: 9 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
268 | | - | |
| 267 | + | |
| 268 | + | |
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
278 | 280 | | |
279 | 281 | | |
280 | 282 | | |
| |||
288 | 290 | | |
289 | 291 | | |
290 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
291 | 296 | | |
292 | 297 | | |
293 | 298 | | |
| |||
314 | 319 | | |
315 | 320 | | |
316 | 321 | | |
317 | | - | |
318 | | - | |
| 322 | + | |
319 | 323 | | |
320 | | - | |
| 324 | + | |
321 | 325 | | |
322 | 326 | | |
323 | 327 | | |
| |||
0 commit comments