Discussion:
[Erp5-dev] Problem while logging into unit test
Łukasz Nowak
2007-11-05 13:20:48 UTC
Permalink
Hello,

I'm using revision 17264. I'm not able to login into my unit tests (but
I'm able to do it, while running zope normally).

This is what I found in unit_test/tests/zLOG.log:

2007-11-05T14:18:34 ERROR(200) BeforeTraverse Error while invoking
hook: "cookie_authentication" Traceback (most recent call last):
File "/home/shufla/erp5/lib/python/ZPublisher/BeforeTraverse.py",
line 144, in __call__ meth(*(container, request, None)[:args])
File
"/home/shufla/erp5/lib/python/Products/CMFCore/CookieCrumbler.py", line
230, in __call__ attempt = self.modifyRequest(req, resp) File
"/home/shufla/erp5/lib/python/Products/CMFCore/CookieCrumbler.py", line
199, in modifyRequest method( resp, self.auth_cookie, quote( ac ) )
File "/usr/lib/zope/lib/python/Products/CMFCore/FSPythonScript.py",
line 107, in __call__ self._updateFromFS() File
"/home/shufla/erp5/lib/python/Products/CMFCore/FSObject.py", line 170,
in _updateFromFS self._readFile(1) File
"/usr/lib/zope/lib/python/Products/CMFCore/FSPythonScript.py", line 95,
in _readFile self._write(data, reparse) File
"/usr/lib/zope/lib/python/Products/CMFCore/FSPythonScript.py", line
232, in _write self._v_f = f = ps._v_f AttributeError: _v_f


Using older revision (eg. 15401) on same zope is working great. What
could be a problem?

Regards,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.
Jérome Perrin
2007-11-05 15:12:50 UTC
Permalink
Post by Łukasz Nowak
Hello,
I'm using revision 17264. I'm not able to login into my unit tests (but
I'm able to do it, while running zope normally).
2007-11-05T14:18:34 ERROR(200) BeforeTraverse Error while invoking
File "/home/shufla/erp5/lib/python/ZPublisher/BeforeTraverse.py",
line 144, in __call__ meth(*(container, request, None)[:args])
File
"/home/shufla/erp5/lib/python/Products/CMFCore/CookieCrumbler.py", line
230, in __call__ attempt = self.modifyRequest(req, resp) File
"/home/shufla/erp5/lib/python/Products/CMFCore/CookieCrumbler.py", line
199, in modifyRequest method( resp, self.auth_cookie, quote( ac ) )
File "/usr/lib/zope/lib/python/Products/CMFCore/FSPythonScript.py",
line 107, in __call__ self._updateFromFS() File
"/home/shufla/erp5/lib/python/Products/CMFCore/FSObject.py", line 170,
in _updateFromFS self._readFile(1) File
"/usr/lib/zope/lib/python/Products/CMFCore/FSPythonScript.py", line 95,
in _readFile self._write(data, reparse) File
"/usr/lib/zope/lib/python/Products/CMFCore/FSPythonScript.py", line
232, in _write self._v_f = f = ps._v_f AttributeError: _v_f
Using older revision (eg. 15401) on same zope is working great. What
could be a problem?
Hi,

PythonScripts are now complied lazily in unit tests
http://svn.erp5.org/?view=rev&revision=17063

Unfortunatly this currently breaks FSPythonScripts.

J?rome
Pelletier Vincent
2007-11-05 16:48:51 UTC
Permalink
Post by Jérome Perrin
Post by Łukasz Nowak
"/usr/lib/zope/lib/python/Products/CMFCore/FSPythonScript.py", line
Unfortunatly this currently breaks FSPythonScripts.
BTW, this code looks quite bad, because it reads volatile values. Under heavy
memory load - compared to connection's object cache size - volatile tends to
disapear at any time, including inside the scope of a python function. This
causes statements like
self._v_foo = 1
print self._v_foo
to fail with AttributeError - if unlucky enough.

Just to keep everybody aware about that bad problems that bites you at the
worse possible time if intensive testing is not done.
--
Vincent Pelletier
Yoshinori Okuji
2007-11-06 02:20:30 UTC
Permalink
Post by Pelletier Vincent
Post by Jérome Perrin
Post by Łukasz Nowak
"/usr/lib/zope/lib/python/Products/CMFCore/FSPythonScript.py", line
Unfortunatly this currently breaks FSPythonScripts.
BTW, this code looks quite bad, because it reads volatile values. Under
heavy memory load - compared to connection's object cache size - volatile
tends to disapear at any time, including inside the scope of a python
function. This causes statements like
self._v_foo = 1
print self._v_foo
to fail with AttributeError - if unlucky enough.
This is not true. I describe some principles:

- volatile attributes are stored in connection caches.

- a connection cache is per thread.

- a connection cache may be invalidated only at transaction boundaries
(including savepoints or sub-transactions).

- a connection cache may not be invalidated implicitly (e.g. different from
Python's garbase collection). You must claim where you want to do explicitly
in an execution path (of course, it could be implicit in the sense that such
code can be derived from a third-party add-on, but this is not done
automatically anyway).

So,
Post by Pelletier Vincent
self._v_foo = 1
print self._v_foo
this never raise AttributeError.

Volatile attributes never disappear suddenly, in a sense that an invalidation
activity may or may not invade between lines of your code automatically.

Volatile attributes can disappear in the following cases:

- When you change a connection (e.g. reopen or publishing a new request).

- When you call cacheMinimize on a connection explicitly.

- When you call a transaction commit/abort/savepoint.

- When you invoke a piece of code which is not under your control (because it
might call, for example, get_transaction.commit(1)).

Please don't deprecate the usage of volatile attributes. They are quite useful
in some cases where other mechanisms may not work efficiently. You just need
to understand the nature of volatile attributes, to make them really useful.

YO
--
Yoshinori Okuji, Nexedi CTO
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com
ERP5 Wiki: Developer Zone for ERP5 Community
http://www.erp5.org
Yoshinori Okuji
2007-11-06 02:07:32 UTC
Permalink
Post by Jérome Perrin
Post by Łukasz Nowak
Using older revision (eg. 15401) on same zope is working great. What
could be a problem?
PythonScripts are now complied lazily in unit tests
http://svn.erp5.org/?view=rev&revision=17063
Unfortunatly this currently breaks FSPythonScripts.
Oops. I patched FSPythonScript at r17403. Does it work now?

YO
--
Yoshinori Okuji, Nexedi CTO
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com
ERP5 Wiki: Developer Zone for ERP5 Community
http://www.erp5.org
Łukasz Nowak
2007-11-06 09:42:30 UTC
Permalink
Hello,

On 2007-11-06, 03:07:32
Post by Yoshinori Okuji
Post by Jérome Perrin
Post by Łukasz Nowak
Using older revision (eg. 15401) on same zope is working great.
What could be a problem?
PythonScripts are now complied lazily in unit tests
http://svn.erp5.org/?view=rev&revision=17063
Unfortunatly this currently breaks FSPythonScripts.
Oops. I patched FSPythonScript at r17403. Does it work now?
I'm still not able to log in into pdb-ised test:

Error Type: RuntimeError
Error Value: CMFDefault/skins/control/setAuthCookie.py has errors.

Nothing appears in unit_test/tests/zLOG.log

Revision: 17405

Regards,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.
Yoshinori Okuji
2007-11-12 17:20:16 UTC
Permalink
Post by Łukasz Nowak
Error Type: RuntimeError
Error Value: CMFDefault/skins/control/setAuthCookie.py has errors.
Fixed at r1750.

YO
--
Yoshinori Okuji, Nexedi CTO
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com
ERP5 Wiki: Developer Zone for ERP5 Community
http://www.erp5.org
Yoshinori Okuji
2007-11-12 17:21:28 UTC
Permalink
Post by Yoshinori Okuji
Post by Łukasz Nowak
Error Type: RuntimeError
Error Value: CMFDefault/skins/control/setAuthCookie.py has errors.
Fixed at r1750.
s/1750/17540/

YO
--
Yoshinori Okuji, Nexedi CTO
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com
ERP5 Wiki: Developer Zone for ERP5 Community
http://www.erp5.org
Loading...