Debugging a Hanging Rails App -- Suspect blocking due to file locking

Hello,

I am debugging a Rails app which hangs every one to three days. The process doesn't crash; it just stops responding. I have been unable to predictably reproduce this failure in a testing environment.

The hang occurs after a call to Authentication controller's access method (code below). This action is called many times each day but only once in a while does the call cause a hang.

Right now, my hypothesis is that the hang is file system blocking caused by a file lock. Tmpreaper runs every minute or two to remove old session files. My limited knowledge of Linux file systems makes me think that if it were, lsof would show it holding a lock.

The fact that lsof shows ruby holding two locks on the session file makes me wonder if both Rail's default session handling functionality and the call to "CGI::Session.new(CGI.new, options)" are both trying to keep the same file open, thus causing blocking.

Any clues on what might be causing this locking or how to resolve it?

Thank you,
Ben
Chicago 2006 Alumni