Re: mod_ruby, ebury and module problem
Brian Candler <[email protected]> Wed, 29 Dec 2004 15:34:15 +0000
| Newsgroups | gmane.comp.apache.mod-ruby |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Dec 29, 2004 at 09:35:35AM -0500, Alex Reyes wrote: > Arnaud LACOMBE wrote: > >Hello, > > > >I encoured a strange problem this afternoon with mod_ruby. I use > >mod_ruby with eruby for my CGI which require some module. When I load > >many time a given page the result is not the same each time, The result > >is sometimes the one given by an old version of the module. > > > >The only one way curently to solve the problem is to restart apache ... > > I get virtually the same thing if I make changes to some files. I'm not > sure if the problem is only with "require'd" .rb files, or if it also > happens with .rhtml-only changes. But I know it happens, and restarting > Apache fixes it. > > It's gotten to the point that I restart Apache on any significant > change, which is about 80% of the time. Is this not simply a reflection of the fact that each httpd worker process has its own Ruby interpreter instance? If you change a require'd file, then existing httpd worker processes will not notice it and will continue to run the old code. But any new worker processes which are spawned will have fresh Ruby interpreters which will load the source from scratch, and thus get the new version. Workers are spawned and die dynamically depending on the level of request load, and can be controlled in httpd.conf. However, you're likely to always have at least one around. Restarting apache ensures they are all killed and restarted. Or you could set MaxRequestsPerChild to ensure that each worker process eventually dies and is restarted. Regards, Brian.