-
Notifications
You must be signed in to change notification settings - Fork 28.9k
SPARK-1902 Silence stacktrace from logs when doing port failover to port n+1 #1019
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,11 +194,16 @@ private[spark] object JettyUtils extends Logging { | |
| case s: Success[_] => | ||
| (server, server.getConnectors.head.getLocalPort) | ||
| case f: Failure[_] => | ||
| val nextPort = (currentPort + 1) % 65536 | ||
| server.stop() | ||
| pool.stop() | ||
| logInfo("Failed to create UI at port, %s. Trying again.".format(currentPort)) | ||
| logInfo("Error was: " + f.toString) | ||
| connect((currentPort + 1) % 65536) | ||
| val msg = s"Failed to create UI on port :$currentPort. Trying again on port :$nextPort" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| if(f.toString.contains("Address already in use")) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might fail our style checks, should be |
||
| logWarning(s"$msg - $f") | ||
| } else { | ||
| logError(msg, f.exception) | ||
| } | ||
| connect(nextPort) | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
Shouldn't we keep this line as well? Otherwise you might also be changing the log level of other
jetty.XXloggersThere 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 was assuming that this line was a prior failed attempt at silencing this exact issue that stuck around, so intentionally changed this logging.
My change logs more verbosely for everything under
org.eclipse.jettythat isn'torg.eclipse.jetty.util.component.AbstractLifeCyclesince it's lowering the threshold from WARN down to level of the root, which is INFO. Even if we were silencing something from jetty in addition to the message this change addresses, it'd be better to target that class more directly rather than everything insideorg.eclipse.jettyThere 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.
That other line has been in spark since way before we added this port retrying, so I don't think that's why it's there. IIRC there are various jetty services that will spit out logging information, especially at start up and shut down, and so we've always used this blanket statement. See for example Spark 0.5 which is more than 2 years old (before we even had a UI).
https://github.com/apache/spark/blob/branch-0.5/conf/log4j.properties.template#L7
If you'd like to audit this at some point that would be great (it might be hard to find all cases where jetty will print something). But since this change is about the port issue specifically, it might be good not to change that other behavior in this 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.
Hmm, an audit of jetty logging doesn't sound particularly appealing TBH :) I think I'll leave it in instead