From: Tim Bates Date: 2003-03-07T13:02:37+09:00 Subject: Re: mod_ruby / eruby: intermittent failure to load file On Fri, 7 Mar 2003 2:24 pm, vor_lord@hotmail.com wrote: > require 'FormHelper' # a little helper class to generate some common forms > Because this error only happens about 1 out of 5 times I am completely > baffled. I've configured the browser to not use a cache at all (to try and > eliminate caching effects) yet it still fails in this manner. > > I've never had Ruby 'sometimes' complain about not being able to find a > method. Style aside, what is wrong with the use of include above? > > Can anyone help? Apache runs several child processes to handle incoming connections. By default, it runs 5 under low loadings. mod_ruby caches scripts loaded using 'require', but the caching is separate for each child process. (Not really 'caching', but the actual way it does it is irrelevant.) What is happening here is, one of your child processes is using and old version of FormHelper (presumably) which doesn't contain the create_submit method. When this particular child process answers your request, it fails. Any other time, it works. To force mod_ruby to reload the scripts, either restart Apache and/or use 'load' instead of 'require' in your script. The latter option will add some loading overhead (since you no longer have a hot cache) and so once you're sure FormHelper isn't going to change for a while, you can use 'require' again to get the benefits of that caching. Tim Bates -- tim@bates.id.au