[Silva-general] for Silva-1.{2, 3, 4} users: PlacelessTranslationService and "Shouldn't load state" errors

Jan-Wijbrand Kolman jw at infrae.com
Tue Mar 28 10:53:52 CEST 2006


Over the last month Infrae received a number of reports where sites 
running Silva-1.2, 1.3 or 1.4 were facing so called "Shouldn't load 
state" errors.

The error message that would occur looks like this:

   Error Type: RuntimeError
   Error Value: FS Page Template tab_edit has errors:
   <pre>Shouldn't load state for 0x0cb4 when the connection is

We investigated two of the sites that reported the error and were 
succesful in trying to reproduce the error on a seperate test machine. 
Combined with researching various mailinglist archives for hints[1], we 
were able to pin-point the cause for these errors.

It turns out that the PlacelessTranslationService (the PTS is a 'third 
party' Zope Product, not developed by Infrae, used for localizing the 
SMI) keeps a module level reference to a persistent object in the ZODB.

Since it is a module level reference, it can (and will) used by multiple 
Zope threads.

In certain situations this PTS object has a change of being flushed from 
the ZODB object cache and an atempt is made to reload it. However, since 
the object is referenced from multiple threads, the ZODB cannot load it, 
and raises the "Shouldn't load state" error.

The flushing of the PTS object has a higher chance of happening in the 
context of high-load sites, with a relatively low object cache size and 
where most hits to the Zope server are for the public pages.

The solution to this problem is to remove the PTS from the setups. This 
has some caveats however.

Silva's SMI will not be localized without the PTS installed and will use 
the default language - which is english. Apart from that, Silva *should* 
run fine.

But, there's a chance of UnicodeErrors to occur when the PTS is removed. 
If a UnicodeError occurs in the SMI, this could very well be an encoding 
bug in the Silva code (and thus should be fixed in Silva). If the 
UnicodeError occurs in the public pages, it is likely that the 
pagetemplates used for the public layout contain non-ascii characters 
that should be converted to HTML entities.

Unfortunatly, with the PTS installed, these encoding mistakes will not 
be revealed, because the PTS monkey-patches Zope to make it overly 
tolerant to such issues.

As a temporary work around for that encoding issue, you could install a 
small Product we created called PTSFixes.

It is important to note that starting from version 1.5 the PTS is not 
used by Silva anymore for localisation. From that version on Silva uses 
the Zope-3 infrastructure for localisation through Five.

If you have more questions related to this problem or if the 
explanations are not fully clear yet, please feel free to contact me.

kind regards,

[1] http://article.gmane.org/gmane.comp.web.zope.plone.user/40273

Jan-Wijbrand Kolman
jw at infrae.com

More information about the Silva-general mailing list