# Mod\_rails blocking processes?

**URL:** <https://www.ruby-forum.com/t/mod-rails-blocking-processes/136459>\
**Category:** Rails\
**Created:** [May 2, 2008, 9:55am UTC](https://www.ruby-forum.com/t/mod-rails-blocking-processes/136459 "2008-05-02T09:55:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [May 2, 2008, 9:55am UTC](https://www.ruby-forum.com/t/mod-rails-blocking-processes/136459/1 "2008-05-02T09:55:48Z")

</div>

I’m not really sure how mod\_rails / passenger works but it’s producing  
some strange behavior for me.

I wrote a simple controller action that sleeps for 5 seconds before  
returning the current time. I then called that action from two  
different computers. It took 5 seconds for the first request to finish  
processing and 10 seconds for the second one. That is, the second  
request was blocked from executing until after the first one had been  
finished.

Why does this happen? When I call ps on the server, I see that several  
ruby and apache processes have been spawned. If the ruby process  
servicing the first request is busy, when I send the second request to  
the server, shouldn’t it spawn or use a different process instead of  
waiting for the first one to finish?

– Andrew

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [May 2, 2008, 12:31pm UTC](https://www.ruby-forum.com/t/mod-rails-blocking-processes/136459/2 "2008-05-02T12:31:30Z")

</div>

On May 2, 9:55 am, Andrew F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Why does this happen? When I call ps on the server, I see that several  
> ruby and apache processes have been spawned. If the ruby process  
> servicing the first request is busy, when I send the second request to  
> the server, shouldn’t it spawn or use a different process instead of  
> waiting for the first one to finish?
> 
> – Andrew

I can’t seem to reproduce this. I have this in my controller:

def aaa  
sleep 5  
render :text =\> ‘aaa’  
end

I followed your steps. Both requests finish in 5 seconds.

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [May 2, 2008, 2:25pm UTC](https://www.ruby-forum.com/t/mod-rails-blocking-processes/136459/3 "2008-05-02T14:25:41Z")

</div>

Hrmmm … so after restarting Apache, I’ve had trouble reproducing the  
issue as well. Any idea what that might have been?

– Andrew

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [May 2, 2008, 2:51pm UTC](https://www.ruby-forum.com/t/mod-rails-blocking-processes/136459/4 "2008-05-02T14:51:09Z")

</div>

Another mod\_rails question: Are global variables shared between each  
ruby process?

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [May 9, 2008, 10:41pm UTC](https://www.ruby-forum.com/t/mod-rails-blocking-processes/136459/5 "2008-05-09T22:41:52Z")

</div>

On May 2, 2:50 pm, Andrew F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Anothermod\_railsquestion: Are global variables shared between each  
> ruby process?

No. Each process has its own private memory.
