azure: Warn about memory issues

The nonzero number of memory/memory+Swap usage hits limits may
indicate the possible env instability(crashes, random failures, etc.).

> memory.failcnt		 # show the number of memory usage hits limits
  memory.memsw.failcnt		 # show the number of memory+Swap hits limits

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Stanislav Levin 2021-05-08 07:46:56 +03:00 committed by Alexander Bokovoy
parent 9148ca2e1e
commit b5fdba7a72
2 changed files with 37 additions and 10 deletions

View File

@ -149,16 +149,28 @@ echo "Report disk usage"
compose_execute df -h compose_execute df -h
echo "Report memory statistics" echo "Report memory statistics"
files=" files='/sys/fs/cgroup/memory/memory.memsw.failcnt \
/sys/fs/cgroup/memory/memory.memsw.failcnt /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes \
/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes /sys/fs/cgroup/memory/memory.memsw.max_usage_in_bytes \
/sys/fs/cgroup/memory/memory.memsw.max_usage_in_bytes /sys/fs/cgroup/memory/memory.failcnt \
/sys/fs/cgroup/memory/memory.failcnt /sys/fs/cgroup/memory/memory.max_usage_in_bytes \
/sys/fs/cgroup/memory/memory.max_usage_in_bytes /sys/fs/cgroup/memory/memory.limit_in_bytes \
/sys/fs/cgroup/memory/memory.limit_in_bytes /proc/sys/vm/swappiness \
/proc/sys/vm/swappiness '
"
compose_execute head -n 1 $files MEMORY_STATS_PATH="$project_dir/memory.stats"
compose_execute $BASH_CMD -eu -c \
"for file in $files; do printf '%s=%s\n' \"\$file\" \"\$(head -n 1 \$file)\" ; done" > "$MEMORY_STATS_PATH"
sed -E -n \
's/(.*): .*(memory\.(memsw\.)?failcnt)=([0-9]+)/\1 \2 \4/p' \
"$MEMORY_STATS_PATH" | \
tr -d '\r' | \
while read -r container memtype failcnt; do
if [ "$failcnt" -gt 0 ]; then
grep "^$container.*memory\..*" "$MEMORY_STATS_PATH" >> "$project_dir/memory.warnings"
fi
done
pushd "$project_dir" pushd "$project_dir"
BUILD_REPOSITORY_LOCALPATH="$BUILD_REPOSITORY_LOCALPATH" \ BUILD_REPOSITORY_LOCALPATH="$BUILD_REPOSITORY_LOCALPATH" \

View File

@ -63,6 +63,20 @@ steps:
condition: succeededOrFailed() condition: succeededOrFailed()
displayName: Host's memory statistics displayName: Host's memory statistics
- script: |
set -eu
function emit_warning() {
printf "##vso[task.logissue type=warning]%s\n" "$1"
}
for memory_warn in $(find ${IPA_TESTS_ENV_WORKING_DIR}/*/ -maxdepth 1 -name memory.warnings);
do
env_name="$(basename $(dirname $memory_warn))"
emit_warning "Test env '$env_name' has high memory usage: $(echo '' && cat $memory_warn)"
done
condition: succeededOrFailed()
displayName: Check memory consumption
- script: | - script: |
set -eu set -eu
HOST_JOURNAL=host_journal.log HOST_JOURNAL=host_journal.log
@ -147,6 +161,7 @@ steps:
!*/*.yaml !*/*.yaml
!*/*.log !*/*.log
!*/systemd_boot_logs/*.log !*/systemd_boot_logs/*.log
!*/memory.stats
!*.tar.gz !*.tar.gz
EOF EOF
cat "$artifacts_ignore_path" cat "$artifacts_ignore_path"