Skip to content

Conversation

@ajithme
Copy link
Contributor

@ajithme ajithme commented Mar 14, 2019

What changes were proposed in this pull request?

When we run YarnSchedulerBackendSuite, the class path seems to be made from the classes folder(resource-managers/yarn/target/scala-2.12/classes) instead of jar (resource-managers/yarn/target/spark-yarn_2.12-3.0.0-SNAPSHOT.jar) . ui.getHandlers is in spark-core and its loaded from spark-core.jar which is shaded and hence refers to org.spark_project.jetty.servlet.ServletContextHandler

Here in org.apache.spark.scheduler.cluster.YarnSchedulerBackend, as its not shaded, it expects org.eclipse.jetty.servlet.ServletContextHandler
Refer discussion @ https://issues.apache.org/jira/browse/SPARK-27122?focusedCommentId=16792318&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16792318

Hence as a fix, org.apache.spark.ui.WebUI must only return a wrapper class instance or references so that Jetty classes can be avoided in getters which are accessed outside spark-core

How was this patch tested?

Existing UT can pass

@ajithme
Copy link
Contributor Author

ajithme commented Mar 14, 2019

@cloud-fan
Copy link
Contributor

ok to test

@cloud-fan
Copy link
Contributor

The title makes me think that this is a patch for build files(sbt or maven), but it is not. Can you explain how do you achieve it?

@ajithme ajithme changed the title [SPARK-27122] Avoid exposing shaded jetty classes outside spark-core [SPARK-27122] Jetty classes must not be return via getters in org.apache.spark.ui.WebUI Mar 14, 2019
@ajithme
Copy link
Contributor Author

ajithme commented Mar 14, 2019

@cloud-fan i have updated the PR description and PR title. Does it seem right now.?

@SparkQA
Copy link

SparkQA commented Mar 14, 2019

Test build #103495 has finished for PR 24088 at commit 49921ee.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin vanzin changed the title [SPARK-27122] Jetty classes must not be return via getters in org.apache.spark.ui.WebUI [SPARK-27122][core] Jetty classes must not be return via getters in org.apache.spark.ui.WebUI Mar 14, 2019
@ajithme
Copy link
Contributor Author

ajithme commented Mar 15, 2019

Updated as per review comments. Please check

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the right style. See the class's constructor for an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vanzin I have run scalafmt on modified class and updated the PR. Is it ok now.?

@SparkQA
Copy link

SparkQA commented Mar 15, 2019

Test build #103525 has finished for PR 24088 at commit d7e8404.

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

Copy link
Member

@srowen srowen left a comment

Choose a reason for hiding this comment

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

I'm OK with this approach, as opposed to adjusting the classpath. @ajithme although I only encountered this when running vs Java 11, it doesn't seem specific to Java 11. Maybe it was really just triggered by running the test in isolation. Anyway, seems OK to fix.

@vanzin
Copy link
Contributor

vanzin commented Mar 15, 2019

Looks ok pending tests which don't seem to have re-triggered...

@vanzin
Copy link
Contributor

vanzin commented Mar 15, 2019

retest this please

@SparkQA
Copy link

SparkQA commented Mar 15, 2019

Test build #103535 has finished for PR 24088 at commit 3f4b831.

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

@SparkQA
Copy link

SparkQA commented Mar 16, 2019

Test build #4629 has started for PR 24088 at commit 3f4b831.

@SparkQA
Copy link

SparkQA commented Mar 17, 2019

Test build #4633 has finished for PR 24088 at commit 3f4b831.

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

@srowen
Copy link
Member

srowen commented Mar 17, 2019

Merged to master

@srowen srowen closed this in c324e1d Mar 17, 2019
@dongjoon-hyun
Copy link
Member

Hi, All.
Can we have this in branch-2.4 because it's LTS branch, too?
Originally, this is reported on JDK9+, but this is reproduced in JDK8 (as reported on JIRA), too.

@dongjoon-hyun
Copy link
Member

cc @dbtsai

@srowen
Copy link
Member

srowen commented Sep 12, 2019

This is a pretty internal change right? I think it could be fine for 2.4.

@dongjoon-hyun
Copy link
Member

Thank you, @srowen .
Could you make a backport PR please, @ajithme?

@dongjoon-hyun
Copy link
Member

I made a backport PR to branch-2.4.

dongjoon-hyun pushed a commit that referenced this pull request Sep 15, 2019
… in org.apache.spark.ui.WebUI

### What changes were proposed in this pull request?

This is a backport of #24088 to avoid CCE.

### Why are the changes needed?

When we run YarnSchedulerBackendSuite, the class path seems to be made from the classes folder(`resource-managers/yarn/target/scala-2.12/classes`) instead of jar (`resource-managers/yarn/target/spark-yarn_2.12-*-SNAPSHOT.jar`) . `ui.getHandlers` is in spark-core and its loaded from spark-core.jar which is shaded and hence refers to `org.spark_project.jetty.servlet.ServletContextHandler`

Here in  org.apache.spark.scheduler.cluster.YarnSchedulerBackend, as its not shaded, it expects org.eclipse.jetty.servlet.ServletContextHandler

Refer discussion  https://issues.apache.org/jira/browse/SPARK-27122?focusedCommentId=16792318&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16792318

Hence as a fix, org.apache.spark.ui.WebUI must only return a wrapper class instance or references so that Jetty classes can be avoided in getters which are accessed outside spark-core

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?

Pass the Jenkins with the existing tests.

Closes #25793 from dongjoon-hyun/SPARK-27122.

Authored-by: Ajith <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun added a commit that referenced this pull request Sep 15, 2019
… avoid CCE

### What changes were proposed in this pull request?

[SPARK-27122](#24088) fixes `ClassCastException` at `yarn` module by introducing `DelegatingServletContextHandler`. Initially, this was discovered with JDK9+, but the class path issues affected JDK8 environment, too. After [SPARK-28709](#25439), I also hit the similar issue at `streaming` module.

This PR aims to fix `streaming` module by adding `getContextPath` to `DelegatingServletContextHandler` and using it.

### Why are the changes needed?

Currently, when we test `streaming` module independently, it fails like the following.
```
$ build/mvn test -pl streaming
...
UISeleniumSuite:
- attaching and detaching a Streaming tab *** FAILED ***
  java.lang.ClassCastException: org.sparkproject.jetty.servlet.ServletContextHandler cannot be cast to org.eclipse.jetty.servlet.ServletContextHandler
...
Tests: succeeded 337, failed 1, canceled 0, ignored 1, pending 0
*** 1 TEST FAILED ***
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
```

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?

Pass the Jenkins with the modified tests. And do the following manually.
Since you can observe this when you run `streaming` module test only (instead of running all), you need to install the changed `core` module and use it.

```
$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode)
$ build/mvn install -DskipTests
$ build/mvn test -pl streaming
```

Closes #25791 from dongjoon-hyun/SPARK-29087.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun added a commit that referenced this pull request Sep 15, 2019
… avoid CCE

### What changes were proposed in this pull request?

[SPARK-27122](#24088) fixes `ClassCastException` at `yarn` module by introducing `DelegatingServletContextHandler`. Initially, this was discovered with JDK9+, but the class path issues affected JDK8 environment, too. After [SPARK-28709](#25439), I also hit the similar issue at `streaming` module.

This PR aims to fix `streaming` module by adding `getContextPath` to `DelegatingServletContextHandler` and using it.

### Why are the changes needed?

Currently, when we test `streaming` module independently, it fails like the following.
```
$ build/mvn test -pl streaming
...
UISeleniumSuite:
- attaching and detaching a Streaming tab *** FAILED ***
  java.lang.ClassCastException: org.sparkproject.jetty.servlet.ServletContextHandler cannot be cast to org.eclipse.jetty.servlet.ServletContextHandler
...
Tests: succeeded 337, failed 1, canceled 0, ignored 1, pending 0
*** 1 TEST FAILED ***
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
```

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?

Pass the Jenkins with the modified tests. And do the following manually.
Since you can observe this when you run `streaming` module test only (instead of running all), you need to install the changed `core` module and use it.

```
$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode)
$ build/mvn install -DskipTests
$ build/mvn test -pl streaming
```

Closes #25791 from dongjoon-hyun/SPARK-29087.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 729b318)
Signed-off-by: Dongjoon Hyun <[email protected]>
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.

6 participants