Index: [Article Count Order] [Thread]

Date:  Mon, 13 Sep 2004 18:56:35 -0500
From:  mde@...
Subject:  Sporadic errors with DBI
To:  modruby@... (modruby ML)
Message-Id:  <20040913235635.GA16771@...>
X-Mail-Count: 01298

Mod_ruby people,

I've really been enjoying working with Ruby, and have re-coded my
site at www.epiphanyradio.org to use mod_ruby. I have found Ruby
to be fun to code, and mod_ruby to be very fast and responsive.

However, I've been seeing sporadic errors in my Apache logs which
point to some problem with the database connection.

The first is this one:

[Mon Sep 13 00:19:38 2004] [error] mod_ruby: error in ruby
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:
/usr/lib/ruby/1.8/date/format.rb:6: Date is not a class (TypeError)
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /usr/lib/ruby/1.8/parsedate.rb:4:in `require'
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /usr/lib/ruby/1.8/parsedate.rb:4
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/dbi/sql.rb:8:in `require'
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/dbi/sql.rb:8
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/dbi/dbi.rb:35:in `require'
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/dbi/dbi.rb:35
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/dbi.rb:1:in `require'
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/dbi.rb:1
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /path/to/webdir/index.rbx:3:in `require'
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /path/to/webdir/index.rbx:3
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `load'
[Mon Sep 13 00:19:38 2004] [error] mod_ruby:   from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler'

The second looks like this:

[Mon Sep 13 07:42:58 2004] [error] mod_ruby: error in ruby
[Mon Sep 13 07:42:58 2004] [error] mod_ruby: ./testscript.rb:182:in `dbConnTest': undefined method `connect' for DBI:Module (NoMethodError)
[Mon Sep 13 07:42:58 2004] [error] mod_ruby:   from ./testscript.rb:65:in `testFunc'
[Mon Sep 13 07:42:58 2004] [error] mod_ruby:   from /path/to/webdir/index.rbx:25
[Mon Sep 13 07:42:58 2004] [error] mod_ruby:   from /path/to/webdir/index.rbx:23:in `out'
[Mon Sep 13 07:42:58 2004] [error] mod_ruby:   from /path/to/webdir/index.rbx:23
[Mon Sep 13 07:42:58 2004] [error] mod_ruby:   from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `load'
[Mon Sep 13 07:42:58 2004] [error] mod_ruby:   from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler'

I'm not sure if it's a fatal error, because I can't actually
reproduce it myself when I load the main page.

Some more data points:

1. Apache2 on Gentoo, PostgreSQL database.

2. I also have PHP installed with support for both MySQL 
and PostgreSQL.

3. I installed DBI only with support for PostgreSQL.

4. The problem was much worse when the Ruby code was run
from an Apache include in a .shtml file or a PHP include in
a .php file. I saw the exact same errors, but the part of the
page with the mod_ruby script included would not execute. Also
the errors were much more frequent -- not 100% all the time,
but more often than now.

5. The error seems to be occurring 5-6 times a day now.

6. These are no errors when I run it as a plain CGI. (It's just
painfully slow, of course. :-))

Any ideas on what's going on with this? I'd love to start doing
more work with mod_ruby, but almost everything I do involves
a database connection, so ...

Thank in advance for any ideas. Yoroshiku onegaishimasu.


Matthew