On Wed, Feb 18, 2009 at 5:14 PM, Remy Blank <[email protected]> wrote:
> Erik Bray wrote:
>> But I run Trac with mod_python and Apache with the worker MPM, with
>> multiple child processes.
>
> Same here.
>
>> As I understand it, each child has its own
>> sub-interpreter with its own global data, and thus its own copy of the
>> field cache.
>
> Correct.
>
>> So when reset_ticket_fields() is called it will only
>> invalidate the cache for the process it was called in.
>
> Almost correct. reset_ticket_fields() will invalidate the cache for the
> process *and* touch trac.ini. This in turn will trigger an environment
> reload, which will invalidate all caches in all processes.

Aha!  Very clever.  I knew that it touched trac.ini, but figured that
the only purpose of that was to cause it to be re-parsed for
some...reason.  What I didn't know is that this causes the entire
environment to shut down and restart.  Just never thought about it.
I'll have to try that out then and see how it works in my case.

> However, if your trac.ini is not writable by apache, then the
> environment reload will not be triggered. I bet this is what happened to
> you. I have been bitten by this again yesterday, when I added a new
> component, and had to restart apache for it to be displayed on the
> newticket form. But I didn't remember why this had happened, so thanks
> for the reminder!

No, my trac.ini is writable by Apache--it has to be since I have
numerous plugins that allow modifications of options in it.  I just
didn't know about or understand the self.config.touch() trick.
Furthermore, I was making the cache a module-level global, instead of
an attribute of a Trac Component.  So that was my second mistake in
the past.

Thanks a lot for the clarification!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to