scripts: Ignore RLIMIT_CORE while writing out core dumps
As stated in the core(5) the RLIMIT_CORE is not enforced when kernel is piping core to the collector, hence it will be written out even when it's set to 0. Instead of playing nice and checking the validity of RLIMIT_CORE, simply ignore it and apply our own limit (2GB). This is done for convenience and to make sure that any changes to the way how given distro applies limits (see fedora37) to the processes doesn't affect our core collection. Signed-off-by: Michal Berger <michal.berger@intel.com> Change-Id: Iab8757f548f2a4f0f4b27b4ce66b0a4a84ed2579 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15994 Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
f287da5cb0
commit
9545f9ac49
@ -36,7 +36,7 @@ if [ $(uname -s) = Linux ]; then
|
||||
# Dump the $output_dir path to a file so collector can pick it up while executing.
|
||||
# We don't set in in the core_pattern command line because of the string length limitation
|
||||
# of 128 bytes. See 'man core 5' for details.
|
||||
echo "|$rootdir/scripts/core-collector.sh %P %s %t %c" > /proc/sys/kernel/core_pattern
|
||||
echo "|$rootdir/scripts/core-collector.sh %P %s %t" > /proc/sys/kernel/core_pattern
|
||||
echo "$output_dir/coredumps" > "$rootdir/.coredump_path"
|
||||
|
||||
# make sure nbd (network block device) driver is loaded if it is available
|
||||
|
@ -7,7 +7,7 @@
|
||||
# can include whitespaces or other funny characters, and working
|
||||
# with those on the cmdline would be a nightmare. Use procfs for
|
||||
# the remaining pieces we want to gather:
|
||||
# |$rootdir/scripts/core-collector.sh %P %s %t %c $output_dir
|
||||
# |$rootdir/scripts/core-collector.sh %P %s %t $output_dir
|
||||
|
||||
core_meta() {
|
||||
jq . <<- CORE
|
||||
@ -34,7 +34,6 @@ stderr() {
|
||||
args+=(core_pid)
|
||||
args+=(core_sig)
|
||||
args+=(core_ts)
|
||||
args+=(rlimit)
|
||||
|
||||
read -r "${args[@]}" <<< "$*"
|
||||
|
||||
@ -50,13 +49,8 @@ stderr
|
||||
# RLIMIT_CORE is not enforced when core is piped to us. To make
|
||||
# sure we won't attempt to overload underlying storage, copy
|
||||
# only the reasonable amount of bytes (systemd defaults to 2G
|
||||
# so let's follow that). But first, check limits of terminating
|
||||
# process to see if we need to make any adjustments.
|
||||
max_core=$((1024 * 1024 * 1024 * 2))
|
||||
|
||||
if ((rlimit == 0xffffffffffffffff || rlimit > max_core)); then
|
||||
rlimit=$max_core
|
||||
fi
|
||||
# so let's follow that).
|
||||
rlimit=$((1024 * 1024 * 1024 * 2))
|
||||
|
||||
# Clear path for lz
|
||||
rm -f "$core"{,.{bin,bt,gz,json}}
|
||||
|
Loading…
Reference in New Issue
Block a user