GitHub user zsxwing opened a pull request:
https://github.com/apache/spark/pull/5136
[SPARK-6468][Block Manager] Fix the race condition of subDirs in
DiskBlockManager
There are two race conditions of `subDirs` in `DiskBlockManager`:
1. `getAllFiles` does not use correct locks to read the contents in
`subDirs`. Although it's designed for testing, it's still worth to add correct
locks to eliminate the race condition.
2. The double-check has a race condition in `getFile(filename: String)`. If
a thread finds `subDirs(dirId)(subDirId)` is not null out of the `synchronized`
block, it may not be able to see the correct content of the File instance
pointed by `subDirs(dirId)(subDirId)` according to the Java memory model (there
is no volatile variable here).
This PR fixed the above race conditions.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/zsxwing/spark SPARK-6468
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/5136.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #5136
----
commit cbb872b869d03e6da900cc84fee6410c0709a988
Author: zsxwing <[email protected]>
Date: 2015-03-23T12:39:47Z
Fix the race condition of subDirs in DiskBlockManager
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]