David Heinemeier Hansson wrote: >> After a period of time (few hours / a day), the site stops responding. >> I've tracked down the issue to activerecord. Pages that don't do a db >> query via AR respond fine. >> >> What could be hanging activerecord? A threading issue? A db connection >> issue? > > > Active Record is not thread safe. So if Cerise uses threads to handle > incoming connections that could indeed be your problem. The same issue > arises with WEBrick. Active Record is predominately targetted at > CGI/FCGI/mod_ruby environments where threading is not an issue. Should be easy to fix by using thread-local variables instead of a class variable: module ActiveRecord class Base def self.connection Thread.current['conn'] ||= retrieve_connection Thread.current['conn'] end def self.connection=(conn) Thread.current['conn'] = conn end def self.connected? !Thread.current['conn'].nil? end end end These overrides should do the trick! But haven't tested it! Regards, Michael