Re: [Zope-dev] Zope 2.7 breaks auto refresh

2004-03-03 Thread Jeremy Hylton
On Wed, 2004-03-03 at 08:42, Santi Camps wrote:
> Hi again,
> 
> I've this traceback using Zope 2.7.0 final:
> 
> Module ZPublisher.Publish, line 163, in publish_module_standard
>   * Module ZPublisher.Publish, line 127, in publish
>   * Module Zope.App.startup, line 203, in zpublisher_exception_hook
>   * Module ZPublisher.Publish, line 104, in publish
>   * Module Zope.App.startup, line 221, in commit
>   * Module ZODB.Transaction, line 233, in commit
>   * Module ZODB.Transaction, line 348, in _commit_objects
>   * Module ZODB.Connection, line 435, in commit
> __traceback_info__: (('Products.Transience.TransientObject',
> 'TransientObject'), '\x00\x00\x00\x00\x00\x00\x008', '')

I don't understand this traceback entirely.  What is the exception that
is being raised?  Also, the last line in the traceback doesn't match a
line on my copy of ZODB/Connection.py.  (I've got revision 1.98.4.5.)

> I've tryied to understand the problem.  It seems that now Trasicience
> uses a different ZODB connection (using DBTab), and I think this is the
> cause of the problem.  
> 
> In Zope/App/startup.py, there is the following lines:
> 
> # Initialize the app object
> application = app()
> OFS.Application.initialize(application)
> if Globals.DevelopmentMode:
> # Set up auto-refresh.
> from App.RefreshFuncs import setupAutoRefresh
> setupAutoRefresh(application._p_jar)
> application._p_jar.close()
> 
> 
> This handles the autoRefresh machinery to the main Connection, but I've
> not found anywhere the same has been done with temporary Connection.  
> 
> But in the ZODB/Connection.py there is a global_code_timestamp used to
> compare all Connections _code_timestamp attribute.   
> 
> Then, when the Connection tries to commit, as the _code_timestamp of
> Trasicience connection hasn't been updated, the problem appears.  Almost
> is what I think.

I'm not very familiar with the App.RefreshFuncs code, but I think I can
offer some generic comments.  setupAutoRefresh() calls
ZODB.Connection.updateCodeTimestamp() which will cause every Connection
to reset its cache the next time it is opened.  It wouldn't be safe to
reset the cache at other times, because application code could have a
reference to existing objects.

I don't know how all this affects the Transience connection.  When is it
opened and closed?

Jeremy



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Zope 2.7 breaks auto refresh

2004-03-03 Thread Santi Camps
> I don't understand this traceback entirely.  What is the exception that
> is being raised?  Also, the last line in the traceback doesn't match a
> line on my copy of ZODB/Connection.py.  (I've got revision 1.98.4.5.)
> 

Sorry, the full Traceback is this one (the previous one has a modified
version of Connection.py to add some LOGs):

Traceback (innermost last):

  * Module ZPublisher.Publish, line 163, in publish_module_standard
  * Module ZPublisher.Publish, line 127, in publish
  * Module Zope.App.startup, line 203, in zpublisher_exception_hook
  * Module ZPublisher.Publish, line 104, in publish
  * Module Zope.App.startup, line 221, in commit
  * Module ZODB.Transaction, line 233, in commit
  * Module ZODB.Transaction, line 348, in _commit_objects
  * Module ZODB.Connection, line 425, in commit
__traceback_info__: (('Products.Transience.TransientObject',
'TransientObject'), '\x00\x00\x00\x00\x00\x00\x00)', '')

ValueError: Cache values may only be in one cache. (Also, an error
occurred while attempting to render the standard error message.)


After that, any try to work with the applications raises this other one:


Traceback (innermost last):

  * Module ZPublisher.Publish, line 163, in publish_module_standard
  * Module ZPublisher.Publish, line 127, in publish
  * Module Zope.App.startup, line 203, in zpublisher_exception_hook
  * Module ZPublisher.Publish, line 104, in publish
  * Module Zope.App.startup, line 221, in commit
  * Module ZODB.Transaction, line 233, in commit
  * Module ZODB.Transaction, line 348, in _commit_objects
  * Module ZODB.Connection, line 425, in commit
__traceback_info__: (('BTrees.OOBTree', 'OOBTree'),
'\x00\x00\x00\x00\x00\x00\x00\x0e', '')

ValueError: Cache values may only be in one cache. (Also, an error
occurred while attempting to render the standard error message.)



> > I've tryied to understand the problem.  It seems that now Trasicience
> > uses a different ZODB connection (using DBTab), and I think this is the
> > cause of the problem.  
> > 
> > In Zope/App/startup.py, there is the following lines:
> > 
> > # Initialize the app object
> > application = app()
> > OFS.Application.initialize(application)
> > if Globals.DevelopmentMode:
> > # Set up auto-refresh.
> > from App.RefreshFuncs import setupAutoRefresh
> > setupAutoRefresh(application._p_jar)
> > application._p_jar.close()
> > 
> > 
> > This handles the autoRefresh machinery to the main Connection, but I've
> > not found anywhere the same has been done with temporary Connection.  
> > 
> > But in the ZODB/Connection.py there is a global_code_timestamp used to
> > compare all Connections _code_timestamp attribute.   
> > 
> > Then, when the Connection tries to commit, as the _code_timestamp of
> > Trasicience connection hasn't been updated, the problem appears.  Almost
> > is what I think.
> 
> I'm not very familiar with the App.RefreshFuncs code, but I think I can
> offer some generic comments.  setupAutoRefresh() calls
> ZODB.Connection.updateCodeTimestamp() which will cause every Connection
> to reset its cache the next time it is opened.  It wouldn't be safe to
> reset the cache at other times, because application code could have a
> reference to existing objects.
> 
> I don't know how all this affects the Transience connection.  When is it
> opened and closed?
> 
> Jeremy

I think the error is produced after the second store in the SESSION
variable.  Perhaps the problem is that the temporary Connection is not
closed and openned right.  I will continue debugging

Thanks for your answer

-- 
Santi Camps
http://zetadb.sourceforge.net


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Zope 2.7 breaks auto refresh

2004-03-03 Thread Santi Camps
Hi again,

I've this traceback using Zope 2.7.0 final:

Module ZPublisher.Publish, line 163, in publish_module_standard
  * Module ZPublisher.Publish, line 127, in publish
  * Module Zope.App.startup, line 203, in zpublisher_exception_hook
  * Module ZPublisher.Publish, line 104, in publish
  * Module Zope.App.startup, line 221, in commit
  * Module ZODB.Transaction, line 233, in commit
  * Module ZODB.Transaction, line 348, in _commit_objects
  * Module ZODB.Connection, line 435, in commit
__traceback_info__: (('Products.Transience.TransientObject',
'TransientObject'), '\x00\x00\x00\x00\x00\x00\x008', '')


The error is caused during the "auto refresh" hook.  If auto refresh is
disabled, all works fine.  I've seen that there is a bug in the
collector about this issue: http://zope.org/Collectors/Zope/1010

I've tryied to understand the problem.  It seems that now Trasicience
uses a different ZODB connection (using DBTab), and I think this is the
cause of the problem.  

In Zope/App/startup.py, there is the following lines:

# Initialize the app object
application = app()
OFS.Application.initialize(application)
if Globals.DevelopmentMode:
# Set up auto-refresh.
from App.RefreshFuncs import setupAutoRefresh
setupAutoRefresh(application._p_jar)
application._p_jar.close()


This handles the autoRefresh machinery to the main Connection, but I've
not found anywhere the same has been done with temporary Connection.  

But in the ZODB/Connection.py there is a global_code_timestamp used to
compare all Connections _code_timestamp attribute.   

Then, when the Connection tries to commit, as the _code_timestamp of
Trasicience connection hasn't been updated, the problem appears.  Almost
is what I think.

If anybody can put me in the right direction I can try to provide a
patch.  What do you think ?  Which is the best way to solve this
problem?

Thanks a lot

-- 
Santi Camps
http://zetadb.sourceforge.net


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )