Re: fork not working?
Colin Steele <[email protected]> Wed, 12 Jan 2005 10:34:10 -0500
| Newsgroups | gmane.comp.apache.mod-ruby |
|---|---|
| Message-ID | <[email protected]> |
Ah. Sadly, I can't read japanese, so I didn't catch that part about the
old version. Anyhow, here's the output from /tmp/log:
1.8.1
mod_ruby/1.2.4
Apache/2.0.51 (Fedora)
pid=2769: start
pid=2769: (parent) child=2797
pid=2769: waitpid=#<Process::Status: pid=2797,signaled(SIGSEGV=11)>
pid=2769: program exit
Here's the script:
def log(msg)
File.open('/tmp/log', 'a') {|f| f.puts msg }
end
log RUBY_VERSION
log ENV["MOD_RUBY"]
log Apache.server_version
log "pid=#{$$}: start"
pid = Process.fork {
log "pid=#{$$}: (child) fork OK"
exit 0
}
log "pid=#{$$}: (parent) child=#{pid}"
dummy, status = Process.waitpid2(pid)
log "pid=#{$$}: waitpid=#{status.inspect}"
print "HTTP/1.1 200 OK\r\n"
print "Content-Type: text/plain\r\n"
print "Content-Length: 3\r\n\r\nOK\n"
log "pid=#{$$}: program exit"
exit
On Wed, 2005-01-12 at 09:08, Shugo Maeda wrote:
> Hi,
>
> Colin Steele wrote:
> > Errrr.... yuck is right. I think I must not have had enough coffee when
> > I was writing that one up. Regardless of the poor writeup I did of the
> > problem, it appears to be a known issue. Google helped me find this:
> > http://i.loveruby.net/d/20040328.html
> >
> > I tried the script on that page and sure enough, looks like the same
> > results - the child SEGVs. :(
>
> He said "It was because the version of ruby was old" in that page.
> The script works well on my machine:
>
> from /tmp/log:
>
> pid=3653: start
> pid=3677: (child) fork OK
> pid=3653: (parent) child=3677
> pid=3653: waitpid=#<Process::Status: pid=3677,exited(0)>
> pid=3653: program exit
>
> Please tell me the version of ruby.
> Mine is:
>
> $ ruby -v
> ruby 1.8.2 (2005-01-06) [i386-linux]
>
> Shugo
>