Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-19164 Component hpcc user limits set at startup #10909

Merged
merged 1 commit into from Feb 28, 2018

Conversation

Projects
None yet
5 participants
@mckellyln
Copy link
Contributor

commented Feb 26, 2018

Signed-off-by: Mark Kelly mark.kelly@lexisnexisrisk.com

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Testing:

start/stop HPCC components many times with various edits to /etc/security/limits.conf and verified limits of processes started where properly set.

@hpcc-jirabot

This comment has been minimized.

Copy link

commented Feb 26, 2018

@mckellyln

This comment has been minimized.

Copy link
Contributor Author

commented Feb 26, 2018

@Michael-Gardner please review and test on CentOS.
From below, smoketest ran on CentOS 7.2 and looks ok.

# apply user limits we explicitly added ...
myid=$(id -u 2>/dev/null)
if [[ "${myid}" = "0" ]] ; then
nofile_user=$(su - ${user} -c 'bash -c "ulimit -Hn"' 2>/dev/null)

This comment has been minimized.

Copy link
@mckellyln

mckellyln Feb 26, 2018

Author Contributor

NOTE: could this ever block, expecting input ?

nofile_user=$(su - ${user} -c 'bash -c "ulimit -Hn"' 2>/dev/null)
rc=$?
if [[ $rc -ne 0 ]] ; then
nofile_user=$(grep 'hpcc* hard* nofile' /etc/security/limits.conf 2>/dev/null | awk '{print $4}')

This comment has been minimized.

Copy link
@mckellyln

mckellyln Feb 26, 2018

Author Contributor

NOTE: should we also check if hpcc user limits where instead in /etc/security/limits.d/* file(s) ?

This comment has been minimized.

Copy link
@Michael-Gardner

Michael-Gardner Feb 26, 2018

Contributor

Yeah I think we should check for the limits.d file as well,

fi
fi

# check limits are at least as high as the minimums required ...
limits=(

This comment has been minimized.

Copy link
@mckellyln

mckellyln Feb 26, 2018

Author Contributor

NOTE: or should we just change these values to what is found in /etc/security/limits.conf or limits.d/* ?

@mckellyln mckellyln force-pushed the mckellyln:hpcc_limits branch 2 times, most recently from 50e4641 to 29f74cf Feb 26, 2018

@mckellyln

This comment has been minimized.

Copy link
Contributor Author

commented Feb 26, 2018

@Michael-Gardner updated. Once we finalize this we should extend to the other limits used (nproc etc.)

@mckellyln mckellyln force-pushed the mckellyln:hpcc_limits branch 2 times, most recently from d8dd4fa to 308afd2 Feb 26, 2018

@mckellyln

This comment has been minimized.

Copy link
Contributor Author

commented Feb 26, 2018

@Michael-Gardner updated.

@@ -478,20 +507,34 @@ startCmd() {
local i=0
for element in "${limits[@]}"; do
flag="-${element:4:2}"
name=$(echo ${element} | awk -F= '{print $1}' | cut -c 8-)

This comment has been minimized.

Copy link
@mckellyln

mckellyln Feb 26, 2018

Author Contributor

Is there a more accepted parsing method for this ?

This comment has been minimized.

Copy link
@mckellyln

mckellyln Feb 26, 2018

Author Contributor

This works:

    name=$(echo ${element%=*} | cut -c 8-)

This comment has been minimized.

Copy link
@mckellyln

mckellyln Feb 26, 2018

Author Contributor

As does this:

    nam1=${element%=*}
    name=${nam1##*_}

This comment has been minimized.

Copy link
@mckellyln

mckellyln Feb 27, 2018

Author Contributor

Updated to use this method to be more consistent with the surrounding code

@mckellyln mckellyln changed the title HPCC-19164 Component hpcc user nofile limit set at startup HPCC-19164 Component hpcc user limits set at startup Feb 26, 2018

@Michael-Gardner

This comment has been minimized.

Copy link
Contributor

commented Feb 27, 2018

@mckellyln Looks like everything works. I snagged the output of ulimit -a and -aH before and after the code you modified, and then did a diff. Looks like its properly modifying all the limits as expected.

@mckellyln mckellyln force-pushed the mckellyln:hpcc_limits branch from 43301f3 to aef186e Feb 27, 2018

HPCC-19164 Component hpcc user limits set at startup
Signed-off-by: Mark Kelly <mark.kelly@lexisnexisrisk.com>

@mckellyln mckellyln force-pushed the mckellyln:hpcc_limits branch from e66b676 to 5664cde Feb 27, 2018

@mckellyln

This comment has been minimized.

Copy link
Contributor Author

commented Feb 27, 2018

@richardkchapman squashed and ready for merge
NOTE: it could go into 6.4.28+ if better suited there.

@HPCCSmoketest

This comment has been minimized.

Copy link
Contributor

commented Feb 27, 2018

Automated Smoketest:
OS: centos 7.2.1511 (Linux 3.10.0-327.28.3.el7.x86_64)
Sha: 5664cde
Build: success
Install hpccsystems-platform-community_6.5.0-trunk0.el7.x86_64.rpm
HPCC Start: OK

Unit tests result:

Test total passed failed errors timeout
unittest 83 83 0 0 0
wutoolTest(Dali) 19 19 0 0 0
wutoolTest(Cassandra) 19 19 0 0 0

Regression test result:

phase total pass fail
setup (hthor) 11 11 0
setup (thor) 11 11 0
setup (roxie) 11 11 0
test (hthor) 764 764 0
test (thor) 678 678 0
test (roxie) 791 791 0

HPCC Stop: OK
HPCC Uninstall: OK
Time stats:

Prep time Build time Package time Install time Start time Test time Stop time Summary
18 sec (00:00:18) 183 sec (00:03:03) 55 sec (00:00:55) 6 sec (00:00:06) 37 sec (00:00:37) 1148 sec (00:19:08) 33 sec (00:00:33) 1480 sec (00:24:40)

@richardkchapman richardkchapman merged commit 2339309 into hpcc-systems:master Feb 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.