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

Print Dynatrace original_core_pattern in javacore if available #17626

Merged
merged 1 commit into from Jul 11, 2023

Conversation

kgibm
Copy link
Contributor

@kgibm kgibm commented Jun 21, 2023

A very common Linux kernel.core_pattern is |/opt/dynatrace/oneagent/agent/rdp installed by the 3rd party monitoring product Dynatrace. When rdp is installed, it saves off the previous kernel.core_pattern into /opt/dynatrace/oneagent/agent/conf/original_core_pattern. When rdp handles a core dump, it first processes it internally, and then sends the core dump to the program in original_core_pattern.

Therefore, it's very common to see the following in a javacore:

2CISYSINFO     /proc/sys/kernel/core_pattern = |/opt/dynatrace/oneagent/agent/rdp

However, that doesn't really help understand where the core dump went because the javacore doesn't print /opt/dynatrace/oneagent/agent/conf/original_core_pattern. This leads to an extra back-and-forth with a customer.

If it's acceptable for J9 to reference third party file locations, then this PR adds this if available. Example from a local build:

2CISYSINFO     /proc/sys/kernel/core_pattern = |/opt/dynatrace/oneagent/agent/rdp
2CISYSINFO     /proc/sys/kernel/core_uses_pid = 1
2CISYSINFO     /opt/dynatrace/oneagent/agent/conf/original_core_pattern = |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h

I also increased the amount of characters printed from such files from 80 to 255 as 80 seemed a bit low to me.

@keithc-ca @pshipton

runtime/rasdump/dmpsup.c Outdated Show resolved Hide resolved
Comment on lines 120 to 124
/* A common core_pattern is |/opt/dynatrace/oneagent/agent/rdp
* This program then sends the core to the originally configured
* core_pattern as shown in the following file.
*/
#define J9RAS_CORE_PATTERN_FILE2 "/opt/dynatrace/oneagent/agent/conf/original_core_pattern"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's reasonable to hard-code this path. Perhaps it should instead be derived from the contents of /proc/sys/kernel/core_pattern. Suppose dynatrace is installed under /usr/local (instead of the default location) so core_pattern contains:

|/usr/local/dynatrace/oneagent/agent/rdp

In that case, the file we want to see might be /usr/local/dynatrace/oneagent/agent/conf/original_core_pattern.

These changes only apply for Linux: What about other platforms where OneAgent is supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense, will do.

What about other platforms where OneAgent is supported?

Their Crash Analysis page only discusses Linux. Presumably, core dumps on other platforms will just be standard.

runtime/rasdump/javadump.cpp Outdated Show resolved Hide resolved
@kgibm kgibm requested a review from keithc-ca June 26, 2023 16:57
runtime/rasdump/dmpsup.c Outdated Show resolved Hide resolved
runtime/rasdump/dmpsup.c Outdated Show resolved Hide resolved
runtime/rasdump/dmpsup.c Outdated Show resolved Hide resolved
runtime/rasdump/rasdump_internal.h Outdated Show resolved Hide resolved
@kgibm kgibm requested a review from keithc-ca June 27, 2023 14:14
runtime/rasdump/dmpsup.c Outdated Show resolved Hide resolved
runtime/rasdump/dmpsup.c Outdated Show resolved Hide resolved
runtime/rasdump/dmpsup.c Outdated Show resolved Hide resolved
runtime/rasdump/dmpsup.c Outdated Show resolved Hide resolved
Signed-off-by: Kevin Grigorenko <kevin.grigorenko@us.ibm.com>
@keithc-ca
Copy link
Contributor

Jenkins compile aix,alinux64,amac,win jdk17

@keithc-ca keithc-ca merged commit 6426c11 into eclipse-openj9:master Jul 11, 2023
7 checks passed
@kgibm
Copy link
Contributor Author

kgibm commented Jul 11, 2023

Thanks!

Note that in containers, the core dump processing program that processes a container core dump runs on the worker node rather than in the container, so the container, by default, will not have access to original_core_pattern and thus it won't be shown in a javacore taken inside a container.

For posterity, tested with:

mkdir -p /opt/dynatrace/oneagent/agent/conf/
cp /bin/true /opt/dynatrace/oneagent/agent/rdp
echo "|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" > /opt/dynatrace/oneagent/agent/conf/original_core_pattern
sysctl -w kernel.core_pattern="|/opt/dynatrace/oneagent/agent/rdp"
sysctl kernel.core_pattern
OUTPUT="$(build/linux-x86_64-server-release/images/jdk/bin/java -Xdump:java:events=vmstop -version 2>&1)"
echo "${OUTPUT}"
grep -A 1 core_pattern $(echo "${OUTPUT}" | awk '/JVMDUMP010I/ { print $NF; }')

Sign up for free to 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.

None yet

3 participants