Skip to content

[SPARK-29046][SQL][2.4] Fix NPE in SQLConf.get when active SparkContext is stopping - #25798

Closed
HeartSaVioR wants to merge 1 commit into
apache:branch-2.4from
HeartSaVioR:SPARK-29046-branch-2.4
Closed

[SPARK-29046][SQL][2.4] Fix NPE in SQLConf.get when active SparkContext is stopping#25798
HeartSaVioR wants to merge 1 commit into
apache:branch-2.4from
HeartSaVioR:SPARK-29046-branch-2.4

Conversation

@HeartSaVioR

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This patch fixes the bug regarding NPE in SQLConf.get, which is only possible when SparkContext._dagScheduler is null due to stopping SparkContext. The logic doesn't seem to consider active SparkContext could be in progress of stopping.

Note that it can't be encountered easily as SparkContext.stop() blocks the main thread, but there're many cases which SQLConf.get is accessed concurrently while SparkContext.stop() is executing - users run another threads, or listener is accessing SQLConf.get after dagScheduler is set to null (this is the case what I encountered.)

Why are the changes needed?

The bug brings NPE.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Previous patch #25753 was tested with new UT, and due to disruption with other tests in concurrent test run, the test is excluded in this patch.

… stopping
### What changes were proposed in this pull request?
This patch fixes the bug regarding NPE in SQLConf.get, which is only possible when SparkContext._dagScheduler is null due to stopping SparkContext. The logic doesn't seem to consider active SparkContext could be in progress of stopping.
Note that it can't be encountered easily as SparkContext.stop() blocks the main thread, but there're many cases which SQLConf.get is accessed concurrently while SparkContext.stop() is executing - users run another threads, or listener is accessing SQLConf.get after dagScheduler is set to null (this is the case what I encountered.)
### Why are the changes needed?
The bug brings NPE.
### Does this PR introduce any user-facing change?
No
### How was this patch tested?
Previous patch apache#25753 was tested with new UT, and due to disruption with other tests in concurrent test run, the test is excluded in this patch.
Closesapache#25790 from HeartSaVioR/SPARK-29046-v2.
Authored-by: Jungtaek Lim (HeartSaVioR) <kabhwan@gmail.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>

@srowensrowen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's a clean fix. Looks OK pending tests.

@HeartSaVioR

Copy link
Copy Markdown
ContributorAuthor

Looks like CI build doesn't have been triggered recently.

@dongjoon-hyun

Copy link
Copy Markdown
Member

Thank you for making a backporting, too.
Yes. Amplab Jenkins has been down Today.

@SparkQA

Copy link
Copy Markdown

Test build #4865 has started for PR 25798 at commit 1816bf9.

@SparkQA

Copy link
Copy Markdown

Test build #110635 has finished for PR 25798 at commit 1816bf9.

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

@dongjoon-hyun

Copy link
Copy Markdown
Member

Thank you all. Merged to branch-2.4.

dongjoon-hyun pushed a commit that referenced this pull request Sep 17, 2019
…xt is stopping
### What changes were proposed in this pull request?
This patch fixes the bug regarding NPE in SQLConf.get, which is only possible when SparkContext._dagScheduler is null due to stopping SparkContext. The logic doesn't seem to consider active SparkContext could be in progress of stopping.
Note that it can't be encountered easily as SparkContext.stop() blocks the main thread, but there're many cases which SQLConf.get is accessed concurrently while SparkContext.stop() is executing - users run another threads, or listener is accessing SQLConf.get after dagScheduler is set to null (this is the case what I encountered.)
### Why are the changes needed?
The bug brings NPE.
### Does this PR introduce any user-facing change?
No
### How was this patch tested?
Previous patch #25753 was tested with new UT, and due to disruption with other tests in concurrent test run, the test is excluded in this patch.
Closes#25798 from HeartSaVioR/SPARK-29046-branch-2.4.
Authored-by: Jungtaek Lim (HeartSaVioR) <kabhwan@gmail.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@HeartSaVioR@dongjoon-hyun@SparkQA@srowen@kiszk@HyukjinKwon