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

Improve crashtracking support for older Bash versions #7956

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,25 @@ fi
# The expected contents are:
# - agent: Path to the agent jar
# - tags: Comma-separated list of tags to be sent with the OOME event; key:value pairs are supported
declare -A config
while IFS="=" read -r key value; do
config["$key"]="$value"
declare "config_$key"="$value"
done < "$configFile"

# Exiting early if configuration is missing
if [ -z "${config_agent}" ] || [ -z "${config_tags}" ]; then
echo "Error: Missing configuration"
exit 1
fi

# Debug: Print the loaded values (Optional)
echo "Agent Jar: ${config[agent]}"
echo "Tags: ${config[tags]}"
echo "Agent Jar: ${config_agent}"
echo "Tags: ${config_tags}"
echo "PID: $PID"

# Execute the Java command with the loaded values
java -Ddd.dogstatsd.start-delay=0 -jar "${config[agent]}" sendOomeEvent "${config[tags]}"
java -Ddd.dogstatsd.start-delay=0 -jar "${config_agent}" sendOomeEvent "${config_tags}"
RC=$?
rm -f ${configFile} # Remove the configuration file
rm -f "${configFile}" # Remove the configuration file

if [ $RC -eq 0 ]; then
echo "OOME Event generated successfully"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,29 @@ fi
# The expected contents are:
# - agent: Path to the agent jar
# - hs_err: Path to the hs_err log file
declare -A config
while IFS="=" read -r key value; do
config["$key"]="$value"
declare "config_$key"="$value"
done < "$configFile"

# Exiting early if configuration is missing
if [ -z "${config_agent}" ] || [ -z "${config_hs_err}" ]; then
echo "Error: Missing configuration"
exit 1
fi

# Debug: Print the loaded values (Optional)
echo "Agent Jar: ${config[agent]}"
echo "Error Log: ${config[hs_err]}"
echo "Agent Jar: ${config_agent}"
echo "Error Log: ${config_hs_err}"
echo "PID: $PID"

# Execute the Java command with the loaded values
java -jar "${config[agent]}" uploadCrash "${config[hs_err]}"
java -jar "${config_agent}" uploadCrash "${config_hs_err}"
RC=$?
rm -f ${configFile} # Remove the configuration file
rm -f "${configFile}" # Remove the configuration file

if [ $RC -eq 0 ]; then
echo "Error file ${config[hs_err]} was uploaded successfully"
echo "Error file ${config_hs_err} was uploaded successfully"
else
echo "Error: Failed to upload error file ${config[hs_err]}"
echo "Error: Failed to upload error file ${config_hs_err}"
exit $RC
fi
Loading