Am Montag, 9. Juli 2007 13:53 schrieb Killhead:
> Hi All,
>
>
>
> I like to implement the following in mod_fcgid:
>
>
>
> -          An rlimit restriction for each process that have spawned of
> mod_fcgid (a php binary)
>
>
>
> I tried the following in arch/unix/fcgid_proc_unix.c on line 100
>
> ( on the end of the function ap_unix_create_privileged_process )
>

As far as I know, there are some restrictions to rlimit settings.  In the 
normal case some can only be done by the super user.  Have you checked your 
rights to do so ?

>
>
>
>
>         struct rlimit reslim;
>
>         reslim.rlim_cur = 40;
>
>         reslim.rlim_max = 40;
>
>         apr_procattr_limit_set(attr, APR_LIMIT_NPROC, &reslim);
>
>
>
>     return apr_proc_create(newproc, newprogname, newargs, env, attr, p);
>
> }
>
>
>
>
>
> This sets the NPROC for my php processes to 40 (good :-) )
>
>
>
> But my mod_fcgid gets errors after a few seconds, because (I think) itself
> can only spawn 40 processes.
>
>
>
> Is there a way to set rlimit only on the spawned process, and not on the
> main process of fast_cgid itself ?
>

So you have to do the rlimit setting in the spawned process (I think this has 
been done by fork ?).  First I'm not really sure about the NPROC variable.  
If it expresses the number of parallel processes this should not run out.

On the other hand you might want to set this variable to reload the fcgi 
process when it has spawned some amount of subprocesses (handled an amount of 
requests).  So I think if you get such an error, try to shut down the current 
fcgi process (better would be to cancel the process when it reached an amount 
of NPROC-1 (NPROC-5 or whatever) processes, that a fresh one would be 
started.

I don't think that there is a way to set rlimits on child processes, since 
they don't have rights to do so.  You would have to install them as suid root 
if you want to do privileged operations in them.  But take care with such 
operations.


>
>
> Regards,
>
> Tom

-- 
==================================================
Ingo Krabbe                     ASK UNIX Systems
Burggrafenstraße 3
44139 Dortmund

Telefon         0231 4770185
FAX             0231 4770186
E-Mail          [EMAIL PROTECTED]
Fingerprint     EE5A 6533 EE5E 8F66 EC20 C56A 35FC
                B736 18FD EB5A
==================================================

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Mod-fcgid-users mailing list
Mod-fcgid-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-fcgid-users

Reply via email to