ait at p2ee.org
Fri Mar 26 14:24:57 UTC 2010
On Fri, Mar 26, 2010 at 3:32 AM, yuanxuqiang <yuanxuqiang at ceopen.cn> wrote:
> I use FreeBSD 7,and install httpd2.2.14; but
> use MPM "prefork",perl cgi don't well run.when runing
> cgi,would appear :
> Internal Server Error
> The server encountered an internal error or misconfiguration and was unable to complete your request.
> apache's err_log :
> Out of memory during request for , referer: http://www.la-bbs.com/
> [Fri Mar 26 15:12:38 2010] [error] [client 126.96.36.199] 28, referer: http://www.la-bbs.com/
> [Fri Mar 26 15:12:38 2010] [error] [client 188.8.131.52] bytes, total sbrk() is , referer: http://www.la-bbs.com/
> [Fri Mar 26 15:12:38 2010] [error] [client 184.108.40.206] 3166208, referer: http://www.la-bbs.com/
> [Fri Mar 26 15:12:38 2010] [error] [client 220.127.116.11] bytes!, referer: http://www.la-bbs.com/
> if use MPM "worker" ,cgi is normal runing.
> why ?
Now _that_ is very odd! People usually have more problems with worker!
The diference between mod_prefork and mod_worker is that the latter is
multi-process and multithreaded while the former is just
multi-process. Now with you matter at hand, are you sure you are
takling about CGI?, I mean are you positive that you are in fact
forking the slave process as a separate program? That question is just
out of curiosity because your problem reminds me of mod_perl problems
with large application where it may make sense to run with worker...
Yes, I know, people will tell you stay away from perl threads like the
page, but in fact I have found situations where it makes perfect sense
to use worker with mod_perl instead of prefork.
In any case, from your log snip, it seems obviuos that Apache is
running out of memory wher trying to fork. Maybe you have no swap in
that machine? Please check with top and look at swap usage. On linux
top shows a wa parameter which will hint that the cpu is waiting
(%wa), on FBSD I _think_ you have to enable process accounting and use
sa, but I'm just a noob in FBSD so perhaps others can ...[fill in
here]..... Every OS has a virtual mem manager logic, (side note: I
have found that vanilla FBSD is way more stable in vm mgmt than
vanilla Linux 2.6 and not so freaking optimistic!).
Anyway, check your mod_prefork section in the apache conf and make
sure you are not trying to fork more processes than the memory you
have available, this includes also complete copies of your cgi
application. So figure out how much memory each apache process takes
up (unload unnecessary modules, etc.) and add to each apache process
the amount of memory your cgi app uses. Also, you should leave the OS
with at least a couple of free megabytes of RAM, although as I stated
earlier FBSDs vm mgmt is so awesome that you can really swap to the
limit, but I wouldn' t recommend that anyway. If you are really
planing on using plain'ol CGI you could recompile apache and make it
very lean for your needs.
If your app is too fat, maybe you try to move to fast-cgi, threaded or
forked so you can keep as much code segments shared between the
childs, or look into mod_perl and mod_morker, but be warned leakage is
inevitable so you have to control the life of each process carefully
(max req per child param).
Hope this helps,
> think you answer me.
> best wishes!
> freebsd-questions at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
More information about the freebsd-questions