Kousuke Saruta created SPARK-53807:
--------------------------------------
Summary: Fix a race condition issue between `unlock` and
`releaseAllLocksForTask` in `BlockInfoManager for write locks
Key: SPARK-53807
URL: https://issues.apache.org/jira/browse/SPARK-53807
Project: Spark
Issue Type: Sub-task
Components: Block Manager, Spark Core
Affects Versions: 4.1.0
Reporter: Kousuke Saruta
When `unlock` and `releaseAllLocksForTask` try to release the same lock for a
task, assertion error can happen.
This issue can be reproduced by adding following test into
`BlockInfoManagerSuite`.
{code}
val blockId = TestBlockId("block")
assert(blockInfoManager.lockNewBlockForWriting(blockId, newBlockInfo()))
blockInfoManager.unlock(blockId)
// Without the fix the block below almost always fails.
(0 to 10).foreach { task =>
withTaskId(task) {
blockInfoManager.registerTask(task)
assert(blockInfoManager.lockForWriting(blockId).isDefined)
val future = Future(blockInfoManager.unlock(blockId, Option(task)))
blockInfoManager.releaseAllLocksForTask(task)
ThreadUtils.awaitReady(future, 100.millis)
}
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]