Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

Bug in FSPythonScript?

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


roche at upfrontsystems

Sep 4, 2008, 10:56 AM

Post #1 of 3 (540 views)
Permalink
Bug in FSPythonScript?

In CMFCore.FSPythonScript.py around line 170 in the _exec method, a
volatile attribute is checked to see if a script has been compiled
properly. The lifetime of volatile attributes cannot be guaranteed
right, so I would assume that this code is not being careful enough.
This is the code I'm talking about:

# Prepare the function.
f = self._v_f
if f is None:
# The script has errors.
__traceback_supplement__ = (
FSPythonScriptTracebackSupplement, self, 0)
raise RuntimeError, '%s has errors.' % self._filepath

I have a few Plone sites that work perfectly 99% of the time, but under
heavy load they raise RuntimeErrors on scripts at precisely this point
in the code. The only explanation seems to be that the volatile
attribute has lost its state. When I "customise" the scripts to force a
recompile it works again.

Seems like a bug?

--
Roché Compaan
Upfront Systems http://www.upfrontsystems.co.za

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


tseaver at palladion

Sep 4, 2008, 2:19 PM

Post #2 of 3 (508 views)
Permalink
Re: Bug in FSPythonScript? [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roché Compaan wrote:
> In CMFCore.FSPythonScript.py around line 170 in the _exec method, a
> volatile attribute is checked to see if a script has been compiled
> properly. The lifetime of volatile attributes cannot be guaranteed
> right, so I would assume that this code is not being careful enough.
> This is the code I'm talking about:
>
> # Prepare the function.
> f = self._v_f
> if f is None:
> # The script has errors.
> __traceback_supplement__ = (
> FSPythonScriptTracebackSupplement, self, 0)
> raise RuntimeError, '%s has errors.' % self._filepath
>
> I have a few Plone sites that work perfectly 99% of the time, but under
> heavy load they raise RuntimeErrors on scripts at precisely this point
> in the code. The only explanation seems to be that the volatile
> attribute has lost its state. When I "customise" the scripts to force a
> recompile it works again.
>
> Seems like a bug?

I've never seen the behavior you report, but inspection suggests that an
extra check would not hurt. E.g., before the 'if f is None' above, adding:

if f is None:
self._readFile(True)
f = self._v_f

should do the trick. If you can generate a patch for this, which
includes a test (calling 'script._p_deactivate()' should mimic the
behavior you are seing), I would be glad to merge it (assuming you don't
have SVN privileges).


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver[at]palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIwFDZ+gerLs4ltQ4RAnpvAKCV3e3C9TPOQiygwY/TtHn4e2DiawCgidlU
DZakIRreq4bJejN8RgWbF9Y=
=+jUJ
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


roche at upfrontsystems

Sep 5, 2008, 1:23 AM

Post #3 of 3 (506 views)
Permalink
Re: Bug in FSPythonScript? [In reply to]

On Thu, 2008-09-04 at 17:19 -0400, Tres Seaver wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Roché Compaan wrote:
> > In CMFCore.FSPythonScript.py around line 170 in the _exec method, a
> > volatile attribute is checked to see if a script has been compiled
> > properly. The lifetime of volatile attributes cannot be guaranteed
> > right, so I would assume that this code is not being careful enough.
> > This is the code I'm talking about:
> >
> > # Prepare the function.
> > f = self._v_f
> > if f is None:
> > # The script has errors.
> > __traceback_supplement__ = (
> > FSPythonScriptTracebackSupplement, self, 0)
> > raise RuntimeError, '%s has errors.' % self._filepath
> >
> > I have a few Plone sites that work perfectly 99% of the time, but under
> > heavy load they raise RuntimeErrors on scripts at precisely this point
> > in the code. The only explanation seems to be that the volatile
> > attribute has lost its state. When I "customise" the scripts to force a
> > recompile it works again.
> >
> > Seems like a bug?
>
> I've never seen the behavior you report, but inspection suggests that an
> extra check would not hurt. E.g., before the 'if f is None' above, adding:
>
> if f is None:
> self._readFile(True)
> f = self._v_f
>
> should do the trick. If you can generate a patch for this, which
> includes a test (calling 'script._p_deactivate()' should mimic the
> behavior you are seing), I would be glad to merge it (assuming you don't
> have SVN privileges).

Thanks, will do.

--
Roché Compaan
Upfront Systems http://www.upfrontsystems.co.za

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.