Greetings,

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"
and
"* 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.)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.