The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Jailed Shell Memory limit

Discussion in 'General Discussion' started by Oleg.Gricik, Mar 17, 2012.

  1. Oleg.Gricik

    Oleg.Gricik Well-Known Member

    Joined:
    Nov 2, 2011
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hi

    Our clients are experiencing some problems with shell access.
    Please:
    ####
    pear list
    Fatal error: Out of memory (allocated 6029312) (tried to allocate 2803918 bytes) in /usr/local/lib/php/PEAR/Registry.php on line 1143
    ####
    server's php.ini file has 64M memory_limit.
    We don't have any limitation in httpd.conf (RLimit).
    Any suggestions?

    Thank you
    Kind Regards
    Oleg G.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Please check to see if "Shell Fork Bomb Protection" is enabled via:

    "WHM >> Security Center >> Shell Fork Bomb Protection"

    If it is, you may want to disable it to verify that it's the cause of this problem.

    Thank you.
     
  3. Oleg.Gricik

    Oleg.Gricik Well-Known Member

    Joined:
    Nov 2, 2011
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hi

    Thank you for suggestion.
    I've just tested.
    Nope, it isn't Shell Fork Bomb Protection.
    Other suggestions?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Could you open a support ticket so we may reproduce the issue on your system?

    Submit A Ticket

    Please keep in mind that Jailshell is a limited environment by design.

    Thank you.
     
  5. Oleg.Gricik

    Oleg.Gricik Well-Known Member

    Joined:
    Nov 2, 2011
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hi

    Yes I know, but where are these limits?
    Is there some conf file?
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Oleg,

    Since this isn't occurring in my environment for my jailed shell user, it's a bit difficult to determine which setting is causing this for you. Typically, limits are placed in /etc/profile or /home/username/.bash_profile areas. Now, it could be one of the following doing it:

    An RLimitMEM setting in /usr/local/apache/conf/httpd.conf file or some other include file
    A lower than normal limit for Max cPanel Process Memory in WHM > Tweak Settings area (bump up to 512 MB in case that might be the case)
    A low memory_limit for PHP in the /usr/local/lib/php.ini file or the php.ini on the account

    If you would open up a ticket as suggested, we can determine what is causing this on your machine.

    Thanks!
     
  7. pavlentij

    pavlentij Registered

    Joined:
    Mar 29, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hello Oleg,

    Have you found a solution for your problem?
    Because I have the same problem on server of project, and support of my server not answering with solution.

    Thanks.
     
  8. Oleg.Gricik

    Oleg.Gricik Well-Known Member

    Joined:
    Nov 2, 2011
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hi

    Nope, we haven't fixed the problem.

    1) /etc/profile
    ####
    # /etc/profile

    # System wide environment and startup programs, for login setup
    # Functions and aliases go in /etc/bashrc

    pathmunge () {
    if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
    if [ "$2" = "after" ] ; then
    PATH=$PATH:$1
    else
    PATH=$1:$PATH
    fi
    fi
    }

    # ksh workaround
    if [ -z "$EUID" -a -x /usr/bin/id ]; then
    EUID=`id -u`
    UID=`id -ru`
    fi

    # Path manipulation
    if [ "$EUID" = "0" ]; then
    pathmunge /sbin
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
    fi

    # No core files by default
    ulimit -S -c 0 > /dev/null 2>&1

    if [ -x /usr/bin/id ]; then
    USER="`id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
    fi

    HOSTNAME=`/bin/hostname`
    HISTSIZE=1000

    if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
    fi

    export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

    for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
    if [ "$PS1" ]; then
    . $i
    else
    . $i >/dev/null 2>&1
    fi
    fi
    done

    unset i
    unset pathmunge
    #cPanel Added local::lib -- BEGIN
    LOCALLIBUSER=$USER
    if [ -e "/usr/bin/whoami" ]; then
    LOCALLIBUSER=`/usr/bin/whoami`
    fi
    if [ "$LOCALLIBUSER" != "root" ]; then
    eval $(perl -Mlocal::lib)
    fi
    #cPanel Added local::lib -- END
    #cPanel Added Limit Protections -- BEGIN

    #unlimit so we can run the whoami
    ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null

    LIMITUSER=$USER
    if [ -e "/usr/bin/whoami" ]; then
    LIMITUSER=`/usr/bin/whoami`
    fi
    if [ "$LIMITUSER" != "root" ]; then
    ulimit -n 100 -u 35 -m 200000 -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
    else
    ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
    fi
    #cPanel Added Limit Protections -- END
    ####
    2) RLimitMEM is disabled
    3) Max cPanel Process Memory is 512MB
    4) memory_limit = 64M in /usr/local/lib/php.ini

    Current error:
    [~]# pear list

    Fatal error: Out of memory (allocated 7602176) (tried to allocate 64 bytes) in /usr/local/lib/php/PEAR/Registry.php on line 1145


    Please note.
    We use CloudLinux with CageFS.
     
  9. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Oleg,

    Can you comment this section out of the file?

    Code:
    LIMITUSER=$USER
    if [ -e "/usr/bin/whoami" ]; then
    LIMITUSER=`/usr/bin/whoami`
    fi
    if [ "$LIMITUSER" != "root" ]; then
    ulimit -n 100 -u 35 -m 200000 -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
    else
    ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
    fi
    It is setting limits. If that doesn't end up being the issue, can you try temporarily disabling CageFS to see the results? It can be disabled using this command:

    Code:
    /usr/sbin/cagefsctl --disable-cagefs
    Thanks!
     
  10. Oleg.Gricik

    Oleg.Gricik Well-Known Member

    Joined:
    Nov 2, 2011
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hi

    I opened a ticket couple hours ago.
    I've disabled Fork Bomb Protection and it fixed the problem.
    (last time this didn't work, strange thing)
    Also, cPanel support member notified me with the following:
    --
    We do have an open internal ticket #52960 with our developers about the limits the Fork Bomb Protection sets being too low.
    --
    Sounds good, will see results.
     
Loading...

Share This Page