Jruby on Rails - Too many files open

Hi,

I have simple Rails app running on Jruby-1.0.1 on Tomcat 5 on Linux.
Every
10 days or so, it crashes because the process has too many open files. I
restarted my application two days ago, and this morning using lsof I see
that my process now has 126 file handles to the file production.log.

In catalina.out, I see a series of entries that look like this:

Oct 8, 2007 10:03:33 PM org.apache.catalina.core.ApplicationContext log
INFO: Runtime 956 loaded
…/actionmailer-1.3.3/lib/action_mailer.rb:49 warning: already
initialized
constant MAX_LINE_LEN

The runtime number is always incremented by one and seems to correspond
to
the number of file handles I have.

Should I be closing the handle to the log file myself? What else should
I
look at to isolate this problem?

Thank you,

Denny Crall


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

On 10/11/07, Dennis C. [email protected] wrote:

Oct 8, 2007 10:03:33 PM org.apache.catalina.core.ApplicationContext log
INFO: Runtime 956 loaded
…/actionmailer-1.3.3/lib/action_mailer.rb:49 warning: already initialized
constant MAX_LINE_LEN

This is a red herring – it doesn’t have anything to do with the open
file issue.

The runtime number is always incremented by one and seems to correspond to
the number of file handles I have.

We probably have a bug here that the log finalizers are not running
and are not closing the files, but you might consider working around
this by not using the Rails log files at all. For example, 1 shows
how we’re doing this, by redirecting Rails logger output to the
servlet context log, which would end up in catalina.out. Just paste
that code at the end of your environment.rb.

/Nick


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

My output is now being logged to catalina.out, but Rails is still
creating
the file handle to its production.log. Even if I have the Logger point
directly to catalina.out, I’m still going to get the dangling file
handle,
right?

Is there an end of request hook I where I can close the logger object
myself?

Thanks,

Denny

On 10/11/07 11:36 AM, “Nick S.” [email protected] wrote:


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

On 10/12/07, Dennis C. [email protected] wrote:

My output is now being logged to catalina.out, but Rails is still creating
the file handle to its production.log. Even if I have the Logger point
directly to catalina.out, I’m still going to get the dangling file handle,
right?

Is there an end of request hook I where I can close the logger object
myself?

Hmm, seems like a bug in my code – should probably close the previous
logger before setting a new device. Try refreshing the paste:

http://pastie.caboo.se/104897

/Nick


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs