Re: System hang problem.
"Paul Krizak" <[email protected]>
| Newsgroups | gmane.linux.redhat.release.taroon.general |
|---|---|
| Message-ID | <[email protected]> |
We solved precisely this problem on our interactive login systems. We
wanted to limit anybody that logged in to 3GB of useable memory (process
size, not RSS).
To do this, I added the following two scripts to /etc/profile.d:
[skaven@adcdog03 /etc/profile.d]$ cat limits.csh
# Set a 3GB process limit size
limit vmemoryuse 3096000
[skaven@adcdog03 /etc/profile.d]$ cat limits.sh
# Set a 3GB process limit size
ulimit -v 3096000
I then had to modify /etc/csh.cshrc and /etc/csh.login. For some odd
reason the RHEL folks have the /etc/profile.d stuff executing for login
shells for bash, but not tcsh. So I added this little tidbit to our
cfengine config:
# Fix RHEL3/RHEL4 /etc/profile.d/*.csh issues -- profile.d should
# only be read for login shells for both bash and tcsh.
profile.(RHEL3|RHEL4)::
# Remove profile.d stuff from cshrc
{ /etc/csh.cshrc
LocateLineMatching "^if.*/etc/profile.d.*"
DeleteToLineMatching "^endif$"
DeleteNLines "1"
CatchAbort
}
# Add profile.d stuff to login
{ /etc/csh.login
BeginGroupIfNoLineMatching "^if.*/etc/profile.d.*"
Append ""
Append "if ( -d /etc/profile.d ) then"
Append "${tab}set nonomatch"
Append "${tab}${tab}foreach i ( /etc/profile.d/*.csh )"
Append "${tab}${tab}if ( -r $i ) then"
Append "${tab}${tab}${tab}source $i"
Append "${tab}${tab}endif"
Append "${tab}${tab}end"
Append "${tab}unset i nonomatch"
Append "endif"
EndGroup
}
The end result is that anybody logging into one of these systems has a
hard limit of 3GB applied to their shell. If you want this limit to
apply to non-login shells, you can try modifying /etc/csh.cshrc and
/etc/bashrc to put the limits in there, though I haven't tried to see if
that works or not.
Paul Krizak 5900 E. Ben White Blvd. MS 625
Advanced Micro Devices Austin, TX 78741
Linux/Unix Systems Engineering Phone: (512) 602-8775
Silicon Design Division
Manish Neema wrote:
> It is not uncommon for us to see a process size ~40GB on 16 GB machines.
> I know, the simple answer would be to buy machines with more RAM.
>
> Anyway, I'll ask my last question again. Under the given circumstances,
> is there any way for me to limit the jobs based on SIZE (and NOT RSS;
> their RAM footprint)?
>
> -Manish
>
>
>
> --
> Taroon-list mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/taroon-list
>
>
--
Taroon-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/taroon-list