Given the way memory limits are currently implemented a program may never have the opportunity to be aware of or report an error resulting in nothing more than a blank page in a browser. That can make memory allocation related problems difficult to isolate given the lack of error reporting (by the application) and lack of user feedback (to the browser). For example, take a typical CGI application written in C that attempts to allocate memory using malloc. If the allocation is larger than is allowed by LVE limits the application is killed and has no opportunity to log an error or display an error to the user.
PHP applications, at least those running under mod_fcgid seem to be able to detect and report memory allocation errors (at this point Im not sure why). Youll typically see an error such as:
[Mon Feb 06 15:55:24 2012] [warn] [client 12.12.12.12] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 786432) (tried to allocate 2900001 bytes) in /vhome/infra/public_html/test/mem_test.php on line 14
when PHP is denied memory due to an LVE limitation. I suspect this is because mod_fcgid is started SUID root yet is running with an EUID of the user attached to the process. As a result the process is exempt fr om LVE lim its since it was started and allocated resources as "root" before the EUID change occured.
PHP applications, at least those running under mod_fcgid seem to be able to detect and report memory allocation errors (at this point Im not sure why). Youll typically see an error such as:
[Mon Feb 06 15:55:24 2012] [warn] [client 12.12.12.12] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 786432) (tried to allocate 2900001 bytes) in /vhome/infra/public_html/test/mem_test.php on line 14
when PHP is denied memory due to an LVE limitation. I suspect this is because mod_fcgid is started SUID root yet is running with an EUID of the user attached to the process. As a result the process is exempt fr om LVE lim its since it was started and allocated resources as "root" before the EUID change occured.
Comment