[ Sorry. I tried to send this to the mod_ruby ML, as Sean suggested, but even 
though I receive messages sent to that list (which I would have thought means 
I'm subscribed), for some reason it won't let me post to it. ]

On Wed, 9 Oct 2002 11:23, Sean Chittenden wrote:
> Try using a global variable instead of a class variable.  Are you
> using apache/reload.rb?  If you reload the class, the old class's
> class variables should get nuked.

I've tried using a global variable and I see the same results (which I half 
expected, since class variables are effectively global variables held inside 
a different namespace ... so to speak).

I checked and there's no reference to apache/reload.rb in my httpd.conf, which 
was based on the example that's supplied with mod_ruby.  All I've done is add 
a RubyPath command and a RubyRequire.

What I'll do is try to throw out all of my code and reproduce the problem with 
a simple class and script.

> This smells like it could be bugish... I wonder if the hash is being
> marked with rb_gc_mark() instead of rb_gc_mark_children().  I wouldn't
> call this a bug quite yet, but it could be.

I wrote a simple class and it's not just a hash that seems to not survive 
across requests.  Basically, every change that's made to the object seems to 
be lost.

It's very weird, since all of the setup that's done in the initialize() seems 
to be maintained, even though the object isn't getting reconstructed (I've 
added a $stderr.puts into initialize() and it's definitely only called once).

It's as though mod_ruby is storing a clone of the object when it's first 
constructed and re-creating the variable from the clone in each session.

Anyway, I'll come back when I have an example that's simple enough to post on 
the list.  Who knows; maybe trying to create that example will highlight 
what's happening ... I live in hope :-).

H.