[cgiapp] How to lazy-load runmodes

Ron Savage ron at savage.net.au
Wed May 25 21:03:37 EDT 2011


Hi gvim

On Thu, 2011-05-26 at 01:42 +0100, gvim wrote:
> On 25/05/2011 07:37, Ron Savage wrote:
> >
> > I don't run Apache anymore. I run nginx and proxy cgi-bin/ to
> > mini-httpd. A 'weird error' won't be in those programs, it'll be in your
> > code, no matter how hard you find that to believe :-))).
> >
> > It's a classic symptom of using a global variable(s), although (of
> > course) it could be something else.
> >
> 
> It was a global variable :-). 'Trouble is it didn't show up when using Apache/CGI. Only when deployed with nginx + Starman. That's why I thought it was a Starman issue. I thought these global variable issues were only with mod_perl but they seem to apply to Starman though I couldn't find any guidelines about avoiding such issues with Starman. OK, I know you shouldn't use globals, and there was only 1 in this module, but if it's going to bork your app this badly it should be documented a la mod_perl. If globals are simply not an option rather than sloppy style it should be clearly stated.

It's not a problem with some specific web server. It's a problem with
persistent environments and carelessly-written programs...

I'd say it'd show up with Apache under load. In your test environment I
suspect the same process responds to every request, but under load the
global variable would be set in 1 process, but when another process
happens to respond, the variable is not set in /that/ process. Hence the
erratic behaviour under load.

-- 
Ron Savage
http://savage.net.au/
Ph: 0421 920 622



More information about the cgiapp mailing list