# How to track down never-ending requests

**URL:** <https://www.ruby-forum.com/t/how-to-track-down-never-ending-requests/148345>\
**Category:** Rails\
**Created:** [September 11, 2008, 10:26pm UTC](https://www.ruby-forum.com/t/how-to-track-down-never-ending-requests/148345 "2008-09-11T22:26:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [September 11, 2008, 10:26pm UTC](https://www.ruby-forum.com/t/how-to-track-down-never-ending-requests/148345/1 "2008-09-11T22:26:15Z")

</div>

Occasionally, my server gets nearly completely unresponsive. Nearly the  
entire CPU usage is spent in IO wait. I’m forced to kill the ruby  
processes to get the server back up. The log files are not very useful  
because the request never finishes so I can’t simply search for requests  
that took at least x seconds. Are there any tools are techniques to  
determine what request is currently in progress?

I’m running Apache 2.2 and Passenger.

Thanks.

–  
Jack C.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [September 11, 2008, 10:35pm UTC](https://www.ruby-forum.com/t/how-to-track-down-never-ending-requests/148345/2 "2008-09-11T22:35:05Z")

</div>

Does it happen on a certain action or when accessing actions in a  
certain controller?

---

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [September 11, 2008, 11:05pm UTC](https://www.ruby-forum.com/t/how-to-track-down-never-ending-requests/148345/3 "2008-09-11T23:05:34Z")

</div>

Srdjan P. wrote:

> Does it happen on a certain action or when accessing actions in a  
> certain controller?

That’s what I’m trying to find out. The request never finishes so  
examining the log file is of limited help.

> > Thanks.
> > 
> > –  
> > Jack C.  
> > removed\_email\_address@domain.invalid

–  
Jack C.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [September 11, 2008, 11:24pm UTC](https://www.ruby-forum.com/t/how-to-track-down-never-ending-requests/148345/4 "2008-09-11T23:24:54Z")

</div>

On Thu, Sep 11, 2008 at 2:05 PM, Jack C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Does it happen on a certain action or when accessing actions in a  
> certain controller?
> 
> That’s what I’m trying to find out. The request never finishes so examining  
> the log file is of limited help.

Put logging statements in your controllers and/or look at your DB log(s)  
(if MySQL, both the query and slow-query logs may be useful).

## HTH,

Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [September 12, 2008, 4:39pm UTC](https://www.ruby-forum.com/t/how-to-track-down-never-ending-requests/148345/5 "2008-09-12T16:39:43Z")

</div>

Sorry, I wasn’t clear. Does it happen on a certain portion of the site  
or is it pretty random? Also, is it reproducible in development or is  
it a production issue? If you’re at your wits end, you could use  
before\_filter to log any and all hits to controllers and actions. If  
it your code is OK, then the timeouts are happening on the DB server  
or there’s a communication problem between the app servers and the DB  
server.

HTH

---

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [September 13, 2008, 12:06am UTC](https://www.ruby-forum.com/t/how-to-track-down-never-ending-requests/148345/6 "2008-09-13T00:06:32Z")

</div>

Srdjan P. wrote:

> Sorry, I wasn’t clear. Does it happen on a certain portion of the site  
> or is it pretty random? Also, is it reproducible in development or is  
> it a production issue? If you’re at your wits end, you could use  
> before\_filter to log any and all hits to controllers and actions. If  
> it your code is OK, then the timeouts are happening on the DB server  
> or there’s a communication problem between the app servers and the DB  
> server.

It has only happened in production and I haven’t been able to duplicate  
it. I may go weeks or more without any issues and then have several  
slowdowns/lockups in a few days. Extra logging might do the trick. Hmmm.  
I could add a database table with PID, controller, action, and start  
time. In the before\_filter log the action completed and in an  
after\_filter mark it completed or delete it. When it locks up I could  
just look in the database for incomplete actions. Might be worth a try.

> > examining the log file is of limited help.
> > 
> > > > that took at least x seconds. Are there any tools are techniques to  
> > > > –  
> > > > Jack C.  
> > > > removed\_email\_address@domain.invalid

–  
Jack C.  
removed\_email\_address@domain.invalid
