-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-22827][CORE] Avoid throwing OutOfMemoryError in case of exception in spill #20014
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 4 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 |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.spark.memory; | ||
|
|
||
| import org.apache.spark.annotation.Private; | ||
|
|
||
| /** | ||
| * This exception is thrown when a task can not acquire memory from the Memory manager. | ||
| * Instead of throwing {@link OutOfMemoryError}, which kills the executor, | ||
| * we should use throw this exception, which just kills the current task. | ||
| */ | ||
| @Private | ||
| public final class SparkOutOfMemoryError extends OutOfMemoryError { | ||
|
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. is this an internal class? if yes perhaps we should label it.
Author
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. Yes, this is an internal class. How do you suggest to label it ?
Member
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. |
||
|
|
||
| public SparkOutOfMemoryError(String s) { | ||
| super(s); | ||
| } | ||
|
|
||
| public SparkOutOfMemoryError(OutOfMemoryError e) { | ||
| super(e.getMessage()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| import org.apache.spark.executor.ShuffleWriteMetrics; | ||
| import org.apache.spark.internal.config.package$; | ||
| import org.apache.spark.memory.MemoryConsumer; | ||
| import org.apache.spark.memory.SparkOutOfMemoryError; | ||
| import org.apache.spark.memory.TaskMemoryManager; | ||
| import org.apache.spark.memory.TooLargePageException; | ||
| import org.apache.spark.serializer.DummySerializerInstance; | ||
|
|
@@ -341,7 +342,7 @@ private void growPointerArrayIfNecessary() throws IOException { | |
| // should have trigger spilling | ||
| if (!inMemSorter.hasSpaceForAnotherRecord()) { | ||
| logger.error("Unable to grow the pointer array"); | ||
| throw e; | ||
| throw new SparkOutOfMemoryError(e); | ||
|
||
| } | ||
| return; | ||
| } | ||
|
|
||
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.
java import should comes first, please keep the previous code.