Skip to content

Conversation

@zhouyejoe
Copy link
Contributor

Jetty handlers are dynamically attached/detached while SHS is running. But the attach and detach operations might be taking place at the same time due to the async in load/clear in Guava Cache.

What changes were proposed in this pull request?

Add synchronization between attachSparkUI and detachSparkUI in SHS.

How was this patch tested?

With this patch, the jetty handlers missing issue never happens again in our production cluster SHS.

…parkUI and detachSparkUI functions to avoid concurrent modification issue to Jetty Handlers.

/** Detach a reconstructed UI from this server. Only valid after bind(). */
override def detachSparkUI(appId: String, attemptId: Option[String], ui: SparkUI): Unit = {
override def detachSparkUI(appId: String, attemptId: Option[String], ui: SparkUI): Unit = this.synchronized {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll trigger tests but this will cause a style violation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Will fix the style violation.

@vanzin
Copy link
Contributor

vanzin commented Mar 6, 2018

ok to test

@SparkQA
Copy link

SparkQA commented Mar 6, 2018

Test build #88018 has finished for PR 20744 at commit f4118c0.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin
Copy link
Contributor

vanzin commented Mar 8, 2018

@zhouyejoe still waiting for the fix...

@zhouyejoe
Copy link
Contributor Author

Updated. Please help trigger the jenkins again. Thanks.

@SparkQA
Copy link

SparkQA commented Mar 9, 2018

Test build #88105 has finished for PR 20744 at commit 45f66a4.

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

attemptId: Option[String],
ui: SparkUI,
completed: Boolean) {
completed: Boolean): Unit = this.synchronized {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... would it be better to synchronize SparkUI.attachHandler and SparkUI.detachHandler? Or maybe restrict the scope of the synchronization here?

This seems too coarse; in the detach case, it synchronizes around the onUIDetached callback which can do expensive locking and I/O.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In order to fine grain the synchronization, can we add synchronize on handlers only?

@SparkQA
Copy link

SparkQA commented Mar 13, 2018

Test build #88187 has finished for PR 20744 at commit cd7e1f6.

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

handlers.synchronized {
ui.getHandlers.foreach(attachHandler)
}
addFilters(ui.getHandlers, conf)
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we also keep handlers synchronized for this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Thanks for catching this. Will update.

@SparkQA
Copy link

SparkQA commented Mar 14, 2018

Test build #88237 has finished for PR 20744 at commit 963c7b3.

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

@zhouyejoe
Copy link
Contributor Author

It is weird that the PySpark unit tests failed, I don't think it is related.

@vanzin
Copy link
Contributor

vanzin commented Mar 16, 2018

This doesn't have anything to do with pyspark, so we can ignore those.

Merging to master / 2.3.

asfgit pushed a commit that referenced this pull request Mar 16, 2018
…parkUI and detachSparkUI functions to avoid concurrent modification issue to Jetty Handlers

Jetty handlers are dynamically attached/detached while SHS is running. But the attach and detach operations might be taking place at the same time due to the async in load/clear in Guava Cache.

## What changes were proposed in this pull request?
Add synchronization between attachSparkUI and detachSparkUI in SHS.

## How was this patch tested?
With this patch, the jetty handlers missing issue never happens again in our production cluster SHS.

Author: Ye Zhou <[email protected]>

Closes #20744 from zhouyejoe/SPARK-23608.

(cherry picked from commit 3675af7)
Signed-off-by: Marcelo Vanzin <[email protected]>
@asfgit asfgit closed this in 3675af7 Mar 16, 2018
mstewart141 pushed a commit to mstewart141/spark that referenced this pull request Mar 24, 2018
…parkUI and detachSparkUI functions to avoid concurrent modification issue to Jetty Handlers

Jetty handlers are dynamically attached/detached while SHS is running. But the attach and detach operations might be taking place at the same time due to the async in load/clear in Guava Cache.

## What changes were proposed in this pull request?
Add synchronization between attachSparkUI and detachSparkUI in SHS.

## How was this patch tested?
With this patch, the jetty handlers missing issue never happens again in our production cluster SHS.

Author: Ye Zhou <[email protected]>

Closes apache#20744 from zhouyejoe/SPARK-23608.
peter-toth pushed a commit to peter-toth/spark that referenced this pull request Oct 6, 2018
…parkUI and detachSparkUI functions to avoid concurrent modification issue to Jetty Handlers

Jetty handlers are dynamically attached/detached while SHS is running. But the attach and detach operations might be taking place at the same time due to the async in load/clear in Guava Cache.

## What changes were proposed in this pull request?
Add synchronization between attachSparkUI and detachSparkUI in SHS.

## How was this patch tested?
With this patch, the jetty handlers missing issue never happens again in our production cluster SHS.

Author: Ye Zhou <[email protected]>

Closes apache#20744 from zhouyejoe/SPARK-23608.

(cherry picked from commit 3675af7)
Signed-off-by: Marcelo Vanzin <[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.

4 participants