In a Python script ("test.py"), I used os.system to execute a c executable "grerand", like below:

os.system ("./grerand sequence sequence 1000")

If I use this script as a CGI script and invoked it via the web (in this case, the invoking user is an apache user). It gave me segmentation fault.

However, as I logged into the server as "root", ran a "ulimit -s unlimited" and then ran this script manually ("python test.py"). It succeeded.

I guess the problem is that "root" has unlimited stack size while "apache" users have some limited stack size. So I tried to modify the /etc/security/limits.conf" file to increase all users' stack size by adding
"* soft stack unlimited"
"* hard stack unlimited". I rebooted the server and tried to invoke the script as a web user (apache user). It failed.

I also tried to modify the httpd.conf by adding "ThreadStackSize 65536*1024" (64MB should be bigger enough). The script still failed.

I wonder how to effectively increase the stack size for apache users? (I am using a redhat enterprise linux.)

10 Years
Discussion Span
Last Post by Ene Uran
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.