Skip to content
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

[SPARK-21253][Core]Fix a bug that StreamCallback may not be notified if network errors happen #18472

Closed
wants to merge 1 commit into from

Conversation

zsxwing
Copy link
Member

@zsxwing zsxwing commented Jun 30, 2017

What changes were proposed in this pull request?

If a network error happens before processing StreamResponse/StreamFailure events, StreamCallback.onFailure won't be called.

This PR fixes failOutstandingRequests to also notify outstanding StreamCallbacks.

How was this patch tested?

The new unit tests.

@zsxwing
Copy link
Member Author

zsxwing commented Jun 30, 2017

cc @vanzin

@cloud-fan
Copy link
Contributor

LGTM, cc @jiangxb1987

@jinxing64
Copy link

Nice catch!
LGTM !

}
for (Tuple2<String, StreamCallback> entry : streamCallbacks) {
try {
entry._2().onFailure(entry._1(), cause);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems the streamId is never used in DownloadCallback.onFailure() ?

}
for (Tuple2<String, StreamCallback> entry : streamCallbacks) {
try {
entry._2().onFailure(entry._1(), cause);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually StreamCallback has a 1-1 mapping to the steam, so ideally we don't need to pass streamId when calling onFailure or onSuccess, the place that creates the StreamCallback already knows which stream this callback is resposible to. I also checked all implemetations of StreamCallback, all of them ignore the streamId parameter. Shall we update the StreamCallback interface?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think keeping streamId doesn't hurt. May be helpful to debug, and also it's consistent with ChunkReceivedCallback.

@SparkQA
Copy link

SparkQA commented Jun 30, 2017

Test build #78939 has finished for PR 18472 at commit fb98f3f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

cloud-fan commented Jun 30, 2017

thanks, merging to master/2.2! we can do the stream id clean up later.

Copy link
Contributor

@jiangxb1987 jiangxb1987 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

asfgit pushed a commit that referenced this pull request Jun 30, 2017
… if network errors happen

## What changes were proposed in this pull request?

If a network error happens before processing StreamResponse/StreamFailure events, StreamCallback.onFailure won't be called.

This PR fixes `failOutstandingRequests` to also notify outstanding StreamCallbacks.

## How was this patch tested?

The new unit tests.

Author: Shixiong Zhu <shixiong@databricks.com>

Closes #18472 from zsxwing/fix-stream-2.

(cherry picked from commit 4996c53)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@asfgit asfgit closed this in 4996c53 Jun 30, 2017
@zsxwing zsxwing deleted the fix-stream-2 branch June 30, 2017 03:00
asfgit pushed a commit that referenced this pull request Jun 30, 2017
## What changes were proposed in this pull request?

A follow up PR to fix Scala 2.10 build for #18472

## How was this patch tested?

Jenkins

Author: Shixiong Zhu <shixiong@databricks.com>

Closes #18478 from zsxwing/SPARK-21253-2.

(cherry picked from commit cfc696f)
Signed-off-by: Shixiong Zhu <shixiong@databricks.com>
asfgit pushed a commit that referenced this pull request Jun 30, 2017
## What changes were proposed in this pull request?

A follow up PR to fix Scala 2.10 build for #18472

## How was this patch tested?

Jenkins

Author: Shixiong Zhu <shixiong@databricks.com>

Closes #18478 from zsxwing/SPARK-21253-2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants