Skip to content

Commit

Permalink
Fix mem_stress_1/memleak subtest failures/hangs due to system swapping
Browse files Browse the repository at this point in the history
If a system has a few Mb of MemFree available but many Gb of SwapFree available,
it is possible currently for tst_buffsize to be set to 1/2Gb. This would cause
most of the journal and receive pools (3 of those each of 1/2Gb) to take a total
of 1-1/2Gb of space and most of it in the swap file. This can slow things down
terribly as was seen in an in-house failure/hang in an armv7l box.

Therefore, avoid the use of swap space and just base calculations on MemFree.
  • Loading branch information
nars1 committed May 14, 2018
1 parent 34fd6b9 commit 014ffcd
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions mem_stress/u_inref/memleak.csh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# Copyright (c) 2002-2016 Fidelity National Information #
# Services, Inc. and/or its subsidiaries. All rights reserved. #
# #
# Copyright (c) 2018 YottaDB LLC. and/or its subsidiaries. #
# All rights reserved. #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
# under a license. If you do not know the terms of #
Expand Down Expand Up @@ -34,23 +37,11 @@ if (($?test_replic) && (! $?gtm_test_replay)) then
if (-f /proc/meminfo) then
# The meminfo lines of interest are:
# MemFree: ###### kB
# SwapFree: ###### kB
# The test creates three buffers: two journal pools and a receive pool.
# So divide free memory into four pieces, allowing a piece for the rest of the test, and base the cap on that.
# awk log() is base e, so divide by log(2) to get base 2.
# Subtract 18 so we can add $random(18) back below.
set cap = `$tst_awk 'BEGIN {mf=0;sf=0} ($1 == "MemFree:") {mf=$2} ($1 == "SwapFree:") {sf=$2} END { print int(log((mf+sf)*1024/4)/log(2)-18) }' /proc/meminfo`
else if (-X svmon) then
# This is for AIX, where the svmon output looks like:
# size inuse free pin virtual available mmode
# memory 7929856 4599144 3330712 2195384 2969212 3848788 Ded
# See above section for a description of the math.
set cap = `svmon -G -O unit=KB | $tst_awk '($1 == "memory") {print int(log((int($7))*1024/4)/log(2)-18) }'`
else if (-x /usr/local/bin/top) then
# Currently this covers Solaris, but may be used elsewhere as long as the top format looks like:
# Memory: ####M phys mem, ####M free mem, ####M total swap, ####M free swap
# See above section for a description of the math.
set cap = `/usr/local/bin/top | $tst_awk '($1 == "Memory:") {print int(log((int($5)+int($11))*1048576/4)/log(2)-18) }'`
set cap = `$tst_awk 'BEGIN {mf=0;sf=0} ($1 == "MemFree:") {mf=$2} END { print int(log((mf)*1024/4)/log(2)-18) }' /proc/meminfo`
endif
if ($cap > $hardcap) then
set cap = $hardcap
Expand Down

0 comments on commit 014ffcd

Please sign in to comment.