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

"Jonathan Bowlas" <[email protected]>
Newsgroups gmane.comp.web.zope.silva.general,gmane.comp.web.zope.silva.devel
Message-ID <008e01c6a4d3$53050350$73602452@bowlas>
Hi Jan,

 

I have a query regarding this PTS fix, we've removed
PlacelessTranslationService and replaced it with PTSFixes and while most
things seem to be functioning correctly there is one exception, the publish
tab of the SMI in a silva news publication of SilvaNewsNetwork (v2.0)
returns the following error:

 

Error Type: TypeError

Error Value: expected string or buffer

 

Traceback (innermost last):

  Module ZPublisher.Publish, line 101, in publish

  Module ZPublisher.mapply, line 88, in mapply

  Module ZPublisher.Publish, line 39, in call_object

  Module Shared.DC.Scripts.Bindings, line 306, in __call__

  Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec

  Module Products.FileSystemSite.FSPageTemplate, line 191, in _exec

  Module Products.FileSystemSite.FSPageTemplate, line 124, in pt_render

  Module Products.PageTemplates.PageTemplate, line 96, in pt_render

   - <FSPageTemplate at
/silva/service_views/SilvaNews/edit/Container/NewsPublication/tab_status>

  Module TAL.TALInterpreter, line 190, in __call__

  Module TAL.TALInterpreter, line 234, in interpret

  Module TAL.TALInterpreter, line 407, in do_optTag_tal

  Module TAL.TALInterpreter, line 389, in no_tag

  Module TAL.TALInterpreter, line 234, in interpret

  Module TAL.TALInterpreter, line 671, in do_useMacro

  Module TAL.TALInterpreter, line 234, in interpret

  Module TAL.TALInterpreter, line 694, in do_defineSlot

  Module TAL.TALInterpreter, line 234, in interpret

  Module TAL.TALInterpreter, line 409, in do_optTag_tal

  Module TAL.TALInterpreter, line 394, in do_optTag

  Module TAL.TALInterpreter, line 389, in no_tag

  Module TAL.TALInterpreter, line 234, in interpret

  Module TAL.TALInterpreter, line 637, in do_condition

  Module TAL.TALInterpreter, line 234, in interpret

  Module TAL.TALInterpreter, line 637, in do_condition

  Module TAL.TALInterpreter, line 234, in interpret

  Module TAL.TALInterpreter, line 637, in do_condition

  Module TAL.TALInterpreter, line 234, in interpret

  Module TAL.TALInterpreter, line 409, in do_optTag_tal

  Module TAL.TALInterpreter, line 394, in do_optTag

  Module TAL.TALInterpreter, line 389, in no_tag

  Module TAL.TALInterpreter, line 234, in interpret

  Module TAL.TALInterpreter, line 291, in do_startTag

  Module TAL.TALInterpreter, line 370, in attrAction_tal

  Module TAL.TALInterpreter, line 623, in translate

  Module Products.PageTemplates.TALES, line 264, in translate

  Module Products.PageTemplates.GlobalTranslationService, line 31, in
translate

TypeError: expected string or buffer

 

I know this is caused by removing PTS as I reinstalled it and this error
didn't occur, any chance you could do a fix for this? Because without it,
there is no way to close news articles located inside a news publication
without accessing this tab so it's causing a problem for our end users.

 

Jon

 

-----Original Message-----

From: [email protected]
[mailto:[email protected]] On Behalf Of Jan-Wijbrand Kolman

Sent: 28 March 2006 09:54

To: [email protected]; [email protected]

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

 

Hello,

 

 

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:

   exceptions.RuntimeError.

   <pre>Shouldn't load state for 0x0cb4 when the connection is

   closed</pre>

 

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,

jw

 

 

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

 

-- 

Jan-Wijbrand Kolman

[email protected]

_______________________________________________

Silva-general mailing list

[email protected]

https://infrae.com/mailman/listinfo/silva-general

_______________________________________________
Silva-general mailing list
[email protected]
https://infrae.com/mailman/listinfo/silva-general
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.