-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-10381] Fix mixup of taskAttemptNumber & attemptId in OutputCommitCoordinator #8544
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c6220fd
Add failing integration test.
JoshRosen a09814b
Fix bug by always using task attempt number.
JoshRosen 0059c95
Add MiMa excludes.
JoshRosen 81b86a1
Merge remote-tracking branch 'origin/master' into SPARK-10381
JoshRosen 7af9c6b
Only add MiMa changes for master (will add others during backport)
JoshRosen 035d660
More attempt -> attemptNumber renaming, per Andrew's suggestion.
JoshRosen 0d40f83
Revert "Only add MiMa changes for master (will add others during back…
JoshRosen 4dcb78a
Merge remote-tracking branch 'origin/master' into SPARK-10381
JoshRosen edbbf6f
Merge remote-tracking branch 'origin/master' into SPARK-10381
JoshRosen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Add failing integration test.
- Loading branch information
commit c6220fd14486e89f6e85642f8c5eeee997338c56
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
core/src/test/scala/org/apache/spark/scheduler/OutputCommitCoordinatorIntegrationSuite.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /* | ||
| * 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.scheduler | ||
|
|
||
| import org.apache.hadoop.mapred.{FileOutputCommitter, TaskAttemptContext} | ||
| import org.scalatest.concurrent.Timeouts | ||
| import org.scalatest.time.{Span, Seconds} | ||
|
|
||
| import org.apache.spark.{SparkConf, SparkContext, LocalSparkContext, SparkFunSuite, TaskContext} | ||
| import org.apache.spark.util.Utils | ||
|
|
||
| /** | ||
| * Integration tests for the OutputCommitCoordinator. | ||
| * | ||
| * See also: [[OutputCommitCoordinatorSuite]] for unit tests that use mocks. | ||
| */ | ||
| class OutputCommitCoordinatorIntegrationSuite | ||
| extends SparkFunSuite | ||
| with LocalSparkContext | ||
| with Timeouts { | ||
|
|
||
| override def beforeAll(): Unit = { | ||
| super.beforeAll() | ||
| val conf = new SparkConf() | ||
| .set("master", "local[2,4]") | ||
| .set("spark.speculation", "true") | ||
| .set("spark.hadoop.mapred.output.committer.class", | ||
| classOf[ThrowExceptionOnFirstAttemptOutputCommitter].getCanonicalName) | ||
| sc = new SparkContext("local[2, 4]", "test", conf) | ||
| } | ||
|
|
||
| test("exception thrown in OutputCommitter.commitTask()") { | ||
| // Regression test for SPARK-10381 | ||
| failAfter(Span(60, Seconds)) { | ||
| val tempDir = Utils.createTempDir() | ||
| try { | ||
| sc.parallelize(1 to 4, 4).map(_.toString).saveAsTextFile(tempDir.getAbsolutePath + "/out") | ||
| } finally { | ||
| Utils.deleteRecursively(tempDir) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private class ThrowExceptionOnFirstAttemptOutputCommitter extends FileOutputCommitter { | ||
| override def commitTask(context: TaskAttemptContext): Unit = { | ||
| val ctx = TaskContext.get() | ||
| if (ctx.attemptNumber < 1) { | ||
| throw new java.io.FileNotFoundException("Intentional exception") | ||
| } | ||
| super.commitTask(context) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The failure mode caused by this bug was an infinite loop, hence this timeout. The fact that the loop does not break after some maximum number of retries is a distinct bug which should be fixed as part of a separate patch.
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.
Any insight on what the other bug is? Is it worth filing another minimal jira for it so we don't lose track of it? (I didn't find anything ... sorry if I just missed it.)
I'm slightly concerned (perhaps just irrationally paranoid) that maybe we'll fix that bug, then regress on this bug, but this unit test won't catch it. this test doesn't have any asserts, it just checks that the job completes and doesn't throw exceptions (not that adding assertions would necessarily help us avoid that scenario either). a minimal jira would at least let us add a note to take another look at this while fixing that issue.
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.
The other bug is due to the fact that DAGScheduler treats failures due to CommitDenied separately from other failures: they don't count towards the typical count of maximum task failures which can trigger a job failure. The correct fix is to add an upper-bound on the number of times that a commit can be denied as a last-ditch safety net to avoid infinite loop behavior.
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.
I will follow a followup JIRA.
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.
makes sense, thanks Josh!
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.
Filed https://issues.apache.org/jira/browse/SPARK-10607 for this