Background jobs with #fork
paddor at gmail.com
Thu Apr 12 17:36:25 UTC 2012
I've migrated from Passenger to Unicorn about a week ago. It's great.
Great transparency and management, thanks for this great software!
A few of my Rails applications start background jobs using
Kernel#fork. Of course, the ActiveRecord connections are closed and
reopened again in the parent and child processes. The child process
also does its job.
Unfortunately, it seems that the parent (a Unicorn worker) waits for
the child (background job) to finish before serving any new requests.
Process.detach is done in the child. Process.setsid is not done. The
child's STDOUT, STDERR and the Rails logger are redirected to their
own files right after forking.
Linux 126.96.36.199-0.21-smp (SUSE 10.2)
The problem persists even when multiple workers are started. And the
problem was not present in the old setup with Passenger.
My question: Does Unicorn somehow check/wait for child processes
forked by the worker processes?
Thanks in advance for your help.
More information about the mongrel-unicorn