-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-29244][Core] Prevent freed page in BytesToBytesMap free again #25953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ | |
| import org.apache.spark.SparkConf; | ||
| import org.apache.spark.executor.ShuffleWriteMetrics; | ||
| import org.apache.spark.memory.MemoryMode; | ||
| import org.apache.spark.memory.SparkOutOfMemoryError; | ||
| import org.apache.spark.memory.TestMemoryConsumer; | ||
| import org.apache.spark.memory.TaskMemoryManager; | ||
| import org.apache.spark.memory.TestMemoryManager; | ||
|
|
@@ -726,4 +727,22 @@ public void avoidDeadlock() throws InterruptedException { | |
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void freeAfterFailedReset() { | ||
| // SPARK-29244: BytesToBytesMap.free after a OOM reset operation should not cause failure. | ||
| memoryManager.limit(5000); | ||
| BytesToBytesMap map = | ||
| new BytesToBytesMap(taskMemoryManager, blockManager, serializerManager, 256, 0.5, 4000); | ||
| // Force OOM on next memory allocation. | ||
| memoryManager.markExecutionAsOutOfMemoryOnce(); | ||
| try { | ||
| map.reset(); | ||
| Assert.fail("Expected SparkOutOfMemoryError to be thrown"); | ||
| } catch (SparkOutOfMemoryError e) { | ||
| // Expected exception; do nothing. | ||
| } finally { | ||
| map.free(); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even though this test suite fails without the Unfortunately, though, that doesn't cause the test to fail! It turns out that the @After
public void tearDown() {
Utils.deleteRecursively(tempDir);
tempDir = null;
if (taskMemoryManager != null) {
Assert.assertEquals(0L, taskMemoryManager.cleanUpAllAllocatedMemory());
long leakedMemory = taskMemoryManager.getMemoryConsumptionForThisTask();
taskMemoryManager = null;
Assert.assertEquals(0L, leakedMemory);
}
}doesn't work as expected because I've opened #25985 to fix that problem. That doesn't need to block merging of this patch, however. |
||
| } | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind adding a one-line comment in the body of the test noting that this is a regression test for
SPARK-29244?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Added.