Appdynamics / HA-toolkit

AppDynamics Controller High Availability Toolkit
https://docs.appdynamics.com/display/PRO42/Using+the+High+Availability+(HA)+Toolkit
Apache License 2.0
13 stars 11 forks source link

Hugepage detection is fragile and breaks when kernel doesn't support Hugepages #93

Open scosol opened 6 years ago

scosol commented 6 years ago

If kernel/OS does not support Hugepages, init.d/ startup script fails (regardless of support requested or not) (Test sample is Ubuntu 16.04 lxbrand on SmartOS)

ENABLE_HUGE_PAGES="false"
HUGE_PAGE_SIZE_BYTES=`awk '/Hugepagesize:/{print $2*1024}' /proc/meminfo`

if [ -f $APPD_ROOT/HA/LARGE_PAGES_ENABLE -a -n "$HUGE_PAGE_SIZE_BYTES" ] ; then
        ENABLE_HUGE_PAGES="true"
fi

^^ HUGE_PAGE_SIZE_BYTES == null because value doesn't exist

Later: (line 1375) -> divide by zero:

  `  (( APPD_HUGE_PAGES = APPD_TOTAL_RESERVED_BYTES / HUGE_PAGE_SIZE_BYTES ))`

Output:

root@appd-node1:/# /etc/init.d/appdcontroller-db start /etc/init.d/appdcontroller-db: line 1375: ((: APPD_HUGE_PAGES = APPD_TOTAL_RESERVED_BYTES / HUGE_PAGE_SIZE_BYTES : division by 0 (error token is "HUGE_PAGE_SIZE_BYTES ") /etc/init.d/appdcontroller-db: line 1377: APPD_TOTAL_RESERVED_BYTES % HUGE_PAGE_SIZE_BYTES : division by 0 (error token is "HUGE_PAGE_SIZE_BYTES ")

scosol commented 6 years ago

I worked around this by hardcoding it to 2048, but that's obviously not "correct".