[CPANEL-22645] Shells spawned via cPanel Terminal inherit memory limits from cpsrvd
[COLOR=rgb(85, 85, 85)]Hello, our webhost directed us here since he was out of ideas as well, so let me try to sum up what is happening.
If you need anything else, please let me know.
So, the issue arises using composer from within cpanel terminal
It not happens via whm terminal and using 'su user' to execute the command. But we need to have this available in cpanel
The command in question, with any package
I know this consumes a lot of memory. Once executed we get
Looking at the top command while executing this, I see the memory jumps max up to 20%, but the cpu hits 100%, so I guess the process gets killed. What we tried - Shell fork bomb protection is off. Tried enabling and higher/lower the values, the error stays the same, always killed of at 591405056 - manually adding the values, same as fork bomb protection - Adjusting the pam values in /etc/security/limits.conf. Doesnt's seem to have any effect though - Higher the php memory limit, to no effect, setting to -1 with php -d memory_limit=-1 composer..... The php cli shouldn't have any limit to begin with if i'm not wrong though - Switching between all kind of mpm for apache with different php handlers and modules, all to no avail System info 1) Cpanel 74.0 (build 9) 2) CENTOS 7.5 virtuozzo 3) Kernel 2.6.32-042stab125.5 4) As you see we on openvz vps, with no swap for ram, host doesn't allow switching to vswap 5) 4gb ram ( 4 processors Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz ) 6) Apache mpm_event with php-fpm and currently for testing purpose without OPcache ulimit -a in whm
[COLOR=rgb(85, 85, 85)] ulimit -a in cpanel Adjusting this via /etc/profile not allows a higher limit than 786432 for memory
[COLOR=rgb(85, 85, 85)] [COLOR=rgb(85, 85, 85)]free -m [COLOR=rgb(85, 85, 85)]
[COLOR=rgb(85, 85, 85)]ipcs -lm [COLOR=rgb(85, 85, 85)]
[COLOR=rgb(85, 85, 85)]Thank you, seb
composer require package/package --profileI know this consumes a lot of memory. Once executed we get
[123.2MB/8.52s] Using version ^2.1 for buzz/laravel-google-captcha
[123.3MB/8.53s] ./composer.json has been updated
[125.2MB/8.75s] Loading composer repositories with package information
[125.4MB/9.11s] Updating dependencies (including require-dev)
mmap() failed: [12] Cannot allocate memory
mmap() failed: [12] Cannot allocate memory
Fatal error: Out of memory (allocated 591405056) (tried to allocate 4096 bytes) in phar:///opt/cpanel/composer/bin/composer/src/Composer/DependencyResolver/Solver.php on line 220
Looking at the top command while executing this, I see the memory jumps max up to 20%, but the cpu hits 100%, so I guess the process gets killed. What we tried - Shell fork bomb protection is off. Tried enabling and higher/lower the values, the error stays the same, always killed of at 591405056 - manually adding the values, same as fork bomb protection - Adjusting the pam values in /etc/security/limits.conf. Doesnt's seem to have any effect though - Higher the php memory limit, to no effect, setting to -1 with php -d memory_limit=-1 composer..... The php cli shouldn't have any limit to begin with if i'm not wrong though - Switching between all kind of mpm for apache with different php handlers and modules, all to no avail System info 1) Cpanel 74.0 (build 9) 2) CENTOS 7.5 virtuozzo 3) Kernel 2.6.32-042stab125.5 4) As you see we on openvz vps, with no swap for ram, host doesn't allow switching to vswap 5) 4gb ram ( 4 processors Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz ) 6) Apache mpm_event with php-fpm and currently for testing purpose without OPcache ulimit -a in whm
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 385882
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 385882
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[COLOR=rgb(85, 85, 85)] ulimit -a in cpanel Adjusting this via /etc/profile not allows a higher limit than 786432 for memory
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 385882
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) 786432
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 385882
virtual memory (kbytes, -v) 786432
file locks (-x) unlimited
[COLOR=rgb(85, 85, 85)] [COLOR=rgb(85, 85, 85)]free -m [COLOR=rgb(85, 85, 85)]
[COLOR=rgb(85, 85, 85)] total used free shared buff/cache available
Mem: 4096 1167 902 133 2026 2783
Swap: 0 0 0
[COLOR=rgb(85, 85, 85)]ipcs -lm [COLOR=rgb(85, 85, 85)]
[COLOR=rgb(85, 85, 85)]------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 32768
max total shared memory (kbytes) = 8388608
min seg size (bytes) = 1
[COLOR=rgb(85, 85, 85)]Thank you, seb
-
Sorry for some formatting issues, tried to edit, but it doesn't allow me due spam detection. Also forgot, php is PHP 7.2.11 0 -
Can someone at least confirm if this an intended feature, or something undocumented? This only happens in the cpanel terminal and not your regular ssh client. ( tested on 2 different vps with different setups ) Also doesn't seem to be affected by the tweak settings Max cPanel process memory (Minimum: 768) 0 -
Hello @seb.witt, Internal case CPANEL-22645 was opened to address an issue where cPanel >> Terminal inherit memory limits from cpsrvd. I'll monitor this case and update this thread once the solution is published. In the meantime, the temporary workaround is to access SSH via a third-party client (or the operating system's built-in client). Alternatively, you can temporarily increase the Max cPanel process memory value in WHM >> Tweak Settings. Thank you. 0 -
Hello, thank you for confirming. [QUOTE]Alternatively, you can temporarily increase the Max cPanel process memory value in WHM >> Tweak Settings.
That was tested as well, as mentioned in my previous post, even setting to unlimited did not work0
Please sign in to leave a comment.
Comments
5 comments