From 668169d9a9f6f2e1851b788ea4dfe40dc067dbcc Mon Sep 17 00:00:00 2001 From: Abhishek Radhakrishnan Date: Fri, 13 Sep 2024 00:17:28 -0400 Subject: [PATCH] Provide `chmod` command for `-XX:OnOutOfMemoryError` from shell script (#17054) A command line arg -XX:OnOutOfMemoryError='chmod 644 ${project.parent.basedir}/target/*.hprof' was added to collect heap dumps: #17029 This arg is causing problems when running tests from Intellij. Intellij doesn't seem to likechmod 644, but this command works as expected in mvn. So as a workaround, add the chmod 644 ${BASE_DIR/target/*.hprof' command in a shell script that can then be executed when OnOutOfMemoryError happens to make Intellij happy. --- dev/chmod-heap-dumps.sh | 19 +++++++++++++++++++ pom.xml | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100755 dev/chmod-heap-dumps.sh diff --git a/dev/chmod-heap-dumps.sh b/dev/chmod-heap-dumps.sh new file mode 100755 index 00000000000..dbb9582224b --- /dev/null +++ b/dev/chmod-heap-dumps.sh @@ -0,0 +1,19 @@ +#!/bin/bash -eux + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +BASE_DIR=$(git rev-parse --show-toplevel) +chmod 644 ${BASE_DIR}/target/*.hprof diff --git a/pom.xml b/pom.xml index 47a6bd5cef3..893e4cb45f9 100644 --- a/pom.xml +++ b/pom.xml @@ -1778,7 +1778,7 @@ -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager -Daws.region=us-east-1 -Ddruid.test.stupidPool.poison=true - -XX:OnOutOfMemoryError='chmod 644 ${project.parent.basedir}/target/*.hprof' + -XX:OnOutOfMemoryError=${project.parent.basedir}/dev/chmod-heap-dumps.sh -XX:HeapDumpPath=${project.parent.basedir}/target -Ddruid.indexing.doubleStorage=double