You can clone with
@@ -391,12 +391,21 @@ thread_cleanup_func_before_exec(void th_ptr)
+thread_cleanup_func(void *th_ptr, int atfork)
rb_thread_t *th = th_ptr;
th->locking_mutex = Qfalse;
+ * Unfortunately, we can't release native threading resource at fork
+ * because libc may have unstable locking state therefore touching
+ * a threading resource may cause a deadlock.
+ if (atfork)
@@ -525,7 +534,7 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
+ thread_cleanup_func(th, FALSE);
@@ -2780,7 +2789,7 @@ terminate_atfork_i(st_data_t key, st_data_t val, st_data_t current_th)
th->keeping_mutexes = NULL;
+ thread_cleanup_func(th, TRUE);
This patch fixes hanging forked processes under 1.9.. which is something you run into plenty if you run God + Ruby 1.9.
This patch was not included in ruby1.9.2p136, so you'll have to apply it manually for now.
Ruby-Lang ticket: http://redmine.ruby-lang.org/issues/show/4169
God ticket for Ruby 1.9: https://github.com/mojombo/god/issues#issue/6