From: Eleanor McHugh Date: 2009-11-12T08:44:55+09:00 Subject: Re: forking behaves differently when using apache On 11 Nov 2009, at 23:37, Nick Brown wrote: > I want a CGI script to fire off another process and continue executing > (or even terminate) without waiting for the process to finish. I wrote > this: > > #!/usr/bin/ruby > require 'cgi' > c = CGI.new > fork do sleep 5 end > c.out {"hello!\n"} > > When I execute that from the command line, it IMMEDIATELY prints > "Content-Type...hello!" and exits. When I run it on Apache and > access it > from my browser, on the other hand, it PAUSES for five seconds, THEN > displays "hello!". > > What's going on? Why does it behave differently with Apache? > > I am using Apache/2.2.12 (Ubuntu) with ruby 1.8.7 (2009-06-12 > patchlevel > 174) [x86_64-linux]. > > Thanks in advance... Do you have Apache configured to use preforked workers or to use threads? Ellie Eleanor McHugh Games With Brains http://slides.games-with-brains.net ---- raise ArgumentError unless @reality.responds_to? :reason