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

[MINOR][YARN] Make memLimitExceededLogMessage more clean #23030

Closed
wants to merge 7 commits into from
Closed

[MINOR][YARN] Make memLimitExceededLogMessage more clean #23030

wants to merge 7 commits into from

Conversation

wangyum
Copy link
Member

@wangyum wangyum commented Nov 14, 2018

What changes were proposed in this pull request?

Current memLimitExceededLogMessage:

It‘s not very clear, because physical memory exceeds but suggestion contains virtual memory config. This pr makes it more clear and replace deprecated config: spark.yarn.executor.memoryOverhead.

How was this patch tested?

manual tests

@SparkQA
Copy link

SparkQA commented Nov 14, 2018

Test build #98814 has finished for PR 23030 at commit e7ff43d.

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

@wangyum
Copy link
Member Author

wangyum commented Nov 14, 2018

cc @vanzin

@srowen
Copy link
Member

srowen commented Nov 14, 2018

Because there are just two calls to this method, and now they behave pretty differently based on one argument, how about just inlining both calls and the regexes to make this simpler?

@SparkQA
Copy link

SparkQA commented Nov 15, 2018

Test build #98859 has finished for PR 23030 at commit 44767f8.

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

val pmemMsg = memLimitExceededLogMessage(diagnostics, PMEM_EXCEEDED_PATTERN)
assert(vmemMsg.contains("5.8 GB of 4.2 GB virtual memory used."))
assert(pmemMsg.contains("2.1 MB of 2 GB physical memory used."))
def logMessage(pattern: Pattern): String = {
Copy link
Member

Choose a reason for hiding this comment

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

I don't feel strongly about it, but I could just remove this test too, and inline the regexes to simplify this. This was just testing the exact error message and I don't know how useful that is.

} else {
""
}
val matcher = VMEM_EXCEEDED_PATTERN.matcher(completedContainer.getDiagnostics)
Copy link
Member

Choose a reason for hiding this comment

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

You can inline these patterns to further simplify.

@SparkQA
Copy link

SparkQA commented Nov 15, 2018

Test build #98877 has finished for PR 23030 at commit 965a984.

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

(true, memLimitExceededLogMessage(
completedContainer.getDiagnostics,
PMEM_EXCEEDED_PATTERN))
val suggestion = s"Consider boosting ${EXECUTOR_MEMORY_OVERHEAD.key}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why isn't this a suggestion in the vmem case too? It can help, even if it's a sledgehammer. Otherwise, you're basically telling the user in that case: "whatcha gonna do? it failed."

(true, memLimitExceededLogMessage(
completedContainer.getDiagnostics,
VMEM_EXCEEDED_PATTERN))
val suggestion = if (conf.getBoolean(YarnConfiguration.NM_VMEM_CHECK_ENABLED,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you even get into this place if vmem checks are disabled?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, and another option that can help here is yarn.nodemanager.vmem-pmem-ratio.

val matcher = PMEM_EXCEEDED_PATTERN.matcher(completedContainer.getDiagnostics)
val diag = if (matcher.find()) " " + matcher.group() + "." else ""
val message =
s"Container killed by YARN for exceeding physical memory limits.$diag $suggestion."
Copy link
Contributor

Choose a reason for hiding this comment

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

Ignoring the above comment, suggestion is always set, so it could be inlined here.

Separately, it's always sub-optimal when formatting is scattered among different variables (e.g. the period at the end of the suggestion is here, the space before the diag is in the diag message itself).

@SparkQA
Copy link

SparkQA commented Nov 16, 2018

Test build #98910 has finished for PR 23030 at commit 8ab6c3b.

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

Pattern.compile(s"$MEM_REGEX of $MEM_REGEX physical memory used")
val VMEM_EXCEEDED_PATTERN =
Pattern.compile(s"$MEM_REGEX of $MEM_REGEX virtual memory used")
val PMEM_EXCEEDED_PATTERN = raw"$MEM_REGEX of $MEM_REGEX physical memory used".r
Copy link
Member

Choose a reason for hiding this comment

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

We can still inline these patterns right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. I will do it.

@SparkQA
Copy link

SparkQA commented Nov 16, 2018

Test build #98916 has finished for PR 23030 at commit 66b3e7f.

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

val vmemExceededPattern = raw"$MEM_REGEX of $MEM_REGEX virtual memory used".r
val diag = vmemExceededPattern.findFirstIn(completedContainer.getDiagnostics)
.map(_.concat(".")).getOrElse("")
val additional = if (conf.getBoolean(YarnConfiguration.NM_VMEM_CHECK_ENABLED,
Copy link
Contributor

Choose a reason for hiding this comment

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

You didn't answer my question. How can you even get here if this config is disabled?

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 see.

@SparkQA
Copy link

SparkQA commented Nov 17, 2018

Test build #98944 has finished for PR 23030 at commit 9ad6df4.

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

.map(_.concat(".")).getOrElse("")
val message = "Container killed by YARN for exceeding virtual memory limits. " +
s"$diag Consider boosting ${EXECUTOR_MEMORY_OVERHEAD.key} or disabling " +
s"${YarnConfiguration.NM_VMEM_CHECK_ENABLED} because of YARN-4714."
Copy link
Contributor

Choose a reason for hiding this comment

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

Now you removed the other config option I asked you to add... :-/

@SparkQA
Copy link

SparkQA commented Nov 17, 2018

Test build #98946 has finished for PR 23030 at commit ca008cd.

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

@srowen
Copy link
Member

srowen commented Nov 20, 2018

Merged to master

@asfgit asfgit closed this in a00aaf6 Nov 20, 2018
jackylee-ch pushed a commit to jackylee-ch/spark that referenced this pull request Feb 18, 2019
## What changes were proposed in this pull request?
Current `memLimitExceededLogMessage`:

<img src="https://user-images.githubusercontent.com/5399861/48467789-ec8e1000-e824-11e8-91fc-280d342e1bf3.png" width="360">

It‘s not very clear, because physical memory exceeds but suggestion contains virtual memory config. This pr makes it more clear and replace  deprecated config: ```spark.yarn.executor.memoryOverhead```.
## How was this patch tested?

manual tests

Closes apache#23030 from wangyum/EXECUTOR_MEMORY_OVERHEAD.

Authored-by: Yuming Wang <yumwang@ebay.com>
Signed-off-by: Sean Owen <sean.owen@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants