Re: fork dies

Eric Hodel <[email protected]>
Newsgroups gmane.comp.apache.mod-ruby
Organization Eric Conspiracy Secret Labs
Message-ID <[email protected]>
Juha-Jarmo Heinonen ([email protected]) wrote:

> 
> I have this problem involving making a subprocess under mod_ruby.
> (It works fine when it's implemented as a cgi.)
> 
> -----------
> 
> fork { some_really_expensive_background_process }
> 
> -----------
> 
> 
> The fork lives only as long as the request. Using sleep() makes the 
> request
> live a little longer, but the fork will die anyway and won't solve the 
> problem.
> The fork process could take hours to complete..
> I have already solved my problem sub-optimally as a cronjob-kludge.
> I'd anyway want to know if this behavior is a bug or "feature" in 
> mod_ruby? ;)

You'd probably have to turn it into a daemon:

http://ruby-talk.org/blade/87467

For the first line, it should instead be fork do ... end if you want the
parent process to stay around (probably).

-- 
Eric Hodel - [email protected] - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04
signature.asc (application/pgp-signature, 187 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQFAVfLKMypVHHlsnwQRAkmTAKDecHbIKmNRh7H7i+UeWGcz8q3kjQCgiGxK
A/WtZknzyVdKJCfwBLm77Tc=
=FcZF
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.