Re: BTrees strangeness (was [Zope-dev] Zope 2.X BIG Session problems - blocker - our site dies - need help of experience Zope developer, please)

2004-03-05 Thread alex

Hi Chris,


On Wed, 3 Mar 2004, Chris McDonough wrote:

 (boldly crossposting this to zodb-dev, please respond on one list or the
 other but not both)
 
 That error *appears* to be caused by reaching a state that is impossible
 to reach.  The code in question is:
 
 for key in list(self._data.keys(None, max_ts)):
 assert(key = max_ts)
 STRICT and _assert(self._data.has_key(key))
 for v in self._data[key].values():
 to_notify.append(v)
 del self._data[key]
 

I was not working yesterday, now I found a big thread about the problem here :)

Thats good that people are interested into resolving of this bug. I will 
read all the mails now, and will try to help to resolve it, since
we have system where the high load causes such problems. 

By the way, just a few minutes ago I have found another session
error, with a little different traceback then reported ago, so
I am posting it here, just in case it helps you understand the prob.


I am still thinking may be something wrong with my code?

-- traceback --



  Site Error

An error was encountered while publishing this resource.

  KeyError
  Sorry, a site error occurred.

Traceback (innermost last):
Module ZPublisher.Publish, line 163, in publish_module_standard
Module Products.iHotfix, line 80, in new_publish
Module ZPublisher.Publish, line 127, in publish
Module Zope.App.startup, line 203, in zpublisher_exception_hook
Module ZPublisher.Publish, line 100, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 40, in call_object
Module OFS.DTMLDocument, line 128, in __call__
DTMLDocument instance at 41bcf6e0
URL: http://www.chalkface.com/custom/index_html/manage_main
Physical Path:/www.chalkface.com/ZWarehouse_0.8/custom/index_html
Module DocumentTemplate.DT_String, line 474, in __call__
Module OFS.DTMLDocument, line 121, in __call__
DTMLDocument instance at 41bcf5f0
URL: http://www.chalkface.com/custom/index.html/manage_main
Physical Path:/www.chalkface.com/ZWarehouse_0.8/custom/index.html
Module DocumentTemplate.DT_String, line 474, in __call__
Module DocumentTemplate.DT_Let, line 76, in render
Module OFS.DTMLDocument, line 121, in __call__
DTMLDocument instance at 41b5d770
URL:  
http://www.chalkface.com/catalog/html/zwarehouse_html_header/ 
manage_main
Physical  
Path:/www.chalkface.com/ZWarehouse_0.8/catalog/html/ 
zwarehouse_html_header
Module DocumentTemplate.DT_String, line 474, in __call__
Module DocumentTemplate.DT_Util, line 201, in eval
  __traceback_info__: cart_functions
Module string, line 1, in expression
Module Shared.DC.Scripts.Bindings, line 306, in __call__
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
Module Products.PythonScripts.PythonScript, line 318, in _exec
Module None, line 16, in setSessionByRequest.py
PythonScript at  
/www.chalkface.com/ZWarehouse_0.8/catalog/cart_functions/ 
setSessionByRequest.py
Line 16
Module ZPublisher.HTTPRequest, line 1218, in __getattr__
Module ZPublisher.HTTPRequest, line 1178, in get
Module Products.Sessions.SessionDataManager, line 93, in  
getSessionData
Module Products.Sessions.SessionDataManager, line 180, in  
_getSessionDataObject
Module Products.Transience.Transience, line 494, in new_or_existing
Module Products.Transience.Transience, line 304, in __setitem__
KeyError: 1078473960 (Also, an error occurred while attempting to  
render the standard error message.)

  Troubleshooting Suggestions
   The URL may be incorrect.
   The parameters passed to this resource may be incorrect.
   A resource that this resource relies on may be  encountering an  
error.

For more detailed information about the error, please  refer to error  
log.

  If the error persists please contact the site maintainer.  Thank you  
for your patience.

--
Alex V. Koval
http://www.halogen-dg.com/
http://www.zwarehouse.org/


___
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] Unexpected Behaviour iterating over catalog search...

2004-03-05 Thread Chris Withers
Hi,

I have something like this:

for brain in Catalog(some_index=some_value):
# delete the object, and then
Catalog.uncatalog_object(brain.getPath())
...which wasn't deleting all objects where some_index=some_value.

On a hunch, I tried:

for brain in tuple(Catalog(some_index=some_value)):
# delete the object, and then
Catalog.uncatalog_object(brain.getPath())
...which magically worked.

Surely the thing returned by a Catalog search should be immutable?

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
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] Schizophrenic ObjectManager?

2004-03-05 Thread Clemens Robbenhaar

Hi Ian,

  
  Now, I want to have it also contain objects of type 'B', but displayed and
  managed through a separate tab in the ZMI. If I click on the Contents tab
  of an instance of F, I get the list of contained A-type objects, with cut,
  copy, paste, delete, etc. If I click on another tab named, say,
  OtherStuff, I want to see exactly the same kind of contents-list
  management page, but for contained B-type objects.
  
  I'm thinking that I might try having F contain an instance of ObjectManager
  as a property, and delegate all B-managing functionality to that. Management
  of A would be handled through F's inherited ObjectManager behavior. What
  concerns me is that the encapsulated second ObjectManager wouldn't have a
  container in the usual way, and that could seriously mess up acquisition.
  
  Another possibility is to maintain only one collection, but to create the
  illusion of two separate collections by having two copies of the contents
  ('manage_main') page, each modified to display only one kind of child.

 The second alternative works, but You need to maintain two separate
copies of the manage_main DTML form the ObjectManager ... currently
Silva does exactly this (except it filtered out some objects by the id,
not the type).

 The downhill is that one has to maintain the copies from the
ObjectManagers DTML, which is not very difficult, but may create some
dependency to the used Zope Version. 
 We have not found a better stable, reliable solution so far.


 An alternative I am currently testing is to have two special attributes
emulating the ObjectManager to the 'manage_main', as You propose in the
first alternative. However You are right: this messes up management of the
ObjectManager items with acquisition ;-)

 The trick is not to use a full ObjectManager attribute but only
something that looks like an ObjectManager to the manage_main, but does
nothing otherwise. Thus it does not get messed up too much as the object
cannot do a lot.

 Currently manage_main only uses the objectItems method, so I
try only to override this. The result looks like: 

class ObjectStub(Acquisition.Implicit):
 a stub filtering out objects of a certain type 

def __init__(self, meta_type):
self._my_meta_type meta_type

def objectItems(self):
return [ x for x in self.aq_parent.objectItems() \
 if not x[1].meta_type==self._my_meta_type ]

# manage_main will use 'objectItems' from this object
# acquire the rest from the parent
manage_main = ObjectManager.manage_main


class MyContainer(ObjectManager, ):
 special container class for A and B objects 

all_meta_tpes = ('A','B')

# list object of type A
object_stub_a = ObjectStub('A')

# list object of type F
object_stub_b = ObjectStub('B')


def manage_main(self):
 list only A objects 
  return self.object_stub_a.manage_main()

def manage_main_b(self):
 list only B objects 
  return self.object_stub_b.manage_main()


manage_options = ObjectManager.manage_option + \
 ({'label':'Contents B', 'action':'manage_main_b'}) + \
 ... other tabs here


Sure there are some missing security declarations, (at least
manage_main_b is public ;-) 
  Also its not exactly my implementation, so it may contain some typos
when I have translated' it from my use case.


 I am not sure if this is really a good idea, however.
This avoids copying around a pretty involved DTML file, but it
seems to create even more subtle dependencies ... e.g. it will certainly
break when mix in OrderedSupport (from 2.7, I have tested the snippets
above only with 2.6.4)

Another drawback of either the approaches is that after evert action
(rename, copy, etc) one ends up in the contents tab listing A (because
this is the manage_main), even if remaining, copying, etc in tab B.


I do not know if it helps, but maybe its at least entertaining ;-)
Clemens

___
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] help

2004-03-05 Thread Chris Withers
Vandana Bajaj wrote:
I am not able to access zope management interface through mozilla.
Could any one guide me why is it happening so.
Can i use Javascript within Zope Page Templates to embed logic
1. zope-dev is for development of Zope, not with it, move your discussion to 
[EMAIL PROTECTED]

2. Don't post in HTML to a non-html list.

3. Provide more detail. What happens when you try and access the ZMI with mozilla?

cheers,

Chris

PS: Yes of course you can put Javascript in ZPT. Using it to embed logic other 
than maybe simple form validation is siully though ;-)

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
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] Execution context

2004-03-05 Thread Chris Withers
Garito wrote:

def __bobo_traverse__(self, Request, Name):
  import sys
  if sys._getframe(1).f_code.co_name == traverse:
   return getattr(self, Name)
  else:
   return self.Propiedad(Name)
Ew... some sick part of me want to ask WHY you're doing thing...

Then again, some people like beating each other with sticks for fun, other 
people program in Perl, each to their own I guess...

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
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] Question about _v_ attributes and database connections

2004-03-05 Thread Chris Withers
Hi Marco,

Marco Bizzarri wrote:

We're trying to tackle a problem in hanging connections in ZPsycopg.
Hehe, I fixed this for ZOracleDA a couple of months ago. You may want to look at 
the thread pool code in there to see how I did it, gimme a nod if you need a URL 
(it's on a CVS branch in cvs.zope.org)

However, I would like to have some information about the functioning of
the _v_ attributes, and the cache management. In particular:
1) where is the code which handles the _v_ attributes (I like to look at
the source code, you know ;))
Never bothered finding it, the sematics are pretty well documented.

2) where is the code which handles the caching of the objects?
The ZODB cache. It's big and complicated, trust me, you DON'T need to go there...

3) is it possible to disable caching of some object?
No. The fact that you want to means you're mis-using _v_ attributes ;-)

4) when an _v_ attribute is removed, what code of the object/attribute
itself is called?
None. I believe it gets lost at the object is ghosted.

If possible, please answer also directly to me (I'm not on this list).
Are you maintaining ZPsychopg? If not, the maintainers might be able to help...

cheers,

Chris - who learnt a whole lot more about ZODB and ZODB caching when solving 
this kind of problem in ZOracleDA ;-)

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
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] Re: [Zope3-dev] Re: Interfaces in Zope 2.5, 2.7, and 3.x

2004-03-05 Thread Martijn Faassen
Tres Seaver wrote:
Here is an excerpt from the 'runzope' I use for FrankenZope sites 
(that is our affectionate name for that Interface package):

[snip script]

Thanks! I'll try this one out.

Regards,

Martijn

___
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] Re: Unexpected Behaviour iterating over catalog search...

2004-03-05 Thread Tres Seaver
Chris Withers wrote:

I have something like this:

for brain in Catalog(some_index=some_value):
# delete the object, and then
Catalog.uncatalog_object(brain.getPath())
...which wasn't deleting all objects where some_index=some_value.

On a hunch, I tried:

for brain in tuple(Catalog(some_index=some_value)):
# delete the object, and then
Catalog.uncatalog_object(brain.getPath())
...which magically worked.

Surely the thing returned by a Catalog search should be immutable?
Nope, it is lazy;  immutability would require realizing it first, 
which would be prohibitively expensive in many cases.  Wrapping 'list()' 
around the result set would've worked, too.

Tres.
--
===
Tres Seaver[EMAIL PROTECTED]
Zope Corporation  Zope Dealers   http://www.zope.com
___
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: [ZODB-Dev] Re: BTrees strangeness (was [Zope-dev] Zope 2.X BIG Session problems - blocker - our site dies - need help of experience Zope developer, please)

2004-03-05 Thread alex

Hi Chris,

On Wed, 3 Mar 2004, Chris McDonough wrote:

 With this text:
 
 zodb_db temporary
 # Temporary storage database (for sessions)
 filestorage
   path $INSTANCE/var/Sessions.fs
 /filestorage
 mount-point /temp_folder
 container-class Products.TemporaryFolder.TemporaryContainer
 /zodb_db

Installed. I had to install new zope instance first, then import
old content via zexp  recreate manually all admins. Because when you 
change the running zope config in Zope 2.7.0 it has no impact on 
temp_folder - Sessions.fs is not created when the temporary storage
was already in place.

Lets see, next test will be on Monday, many users come only on working 
days.

I also got many complatins from customer, so I wrote a test suite
which is logging to a site each 2 minutes, and if there are problem,
it sends emails to all of admins, so they come and restart zope. 

With prev. Transience, when this keyError appear, it was seen
only by 1,2,3 users. With new Transience, when error starts
to appear, nobody is able to see any page which uses Session - 
all sessions became broken.

I am monitoring site now, and will tell you about the results.

--
Alex V. Koval
http://www.halogen-dg.com/
http://www.zwarehouse.org/


___
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] Question about _v_ attributes and database connections

2004-03-05 Thread Marco Bizzarri
On Fri, Mar 05, 2004 at 11:16:37AM +, Chris Withers wrote:
 Hi Marco,

Hi.
 
 Marco Bizzarri wrote:
 
 We're trying to tackle a problem in hanging connections in ZPsycopg.
 
 Hehe, I fixed this for ZOracleDA a couple of months ago. You may want to 
 look at the thread pool code in there to see how I did it, gimme a nod if 
 you need a URL (it's on a CVS branch in cvs.zope.org)

I took a look at that, the connections.CTM, and the other. The simple
question is if this is a known problem with *ALL* db adapters, and, in
this case, it could be possible to devise a general solution, or if this
has something to do with psycopg.

I've a scenario where I can produce hanging connections in ZPsycopg:

1) use page with sql methods
2) refresh a product
3) repeat 1)
4) refresh a product

if you have 4 threads, you should have now 5 connections. Obviously here
there is something wrong with the management of _v_ attributes, in
particular the _v_database_connection in the DA.py. The psycopg code is
quite similar to the basic DA.py code, so I was looking for other ways
of approaching the problem.

 However, I would like to have some information about the functioning of
 the _v_ attributes, and the cache management. In particular:
 
 1) where is the code which handles the _v_ attributes (I like to look at
 the source code, you know ;))
 
 Never bothered finding it, the sematics are pretty well documented.

Yes, actually.

 2) where is the code which handles the caching of the objects?
 
 The ZODB cache. It's big and complicated, trust me, you DON'T need to go 
 there...

:(

 3) is it possible to disable caching of some object?
 
 No. The fact that you want to means you're mis-using _v_ attributes ;-)

My feeling was that the hanging connection problem was related to the
cache... so the question (I'm not using _v_ attributes in any particular
way)

 4) when an _v_ attribute is removed, what code of the object/attribute
 itself is called?
 
 None. I believe it gets lost at the object is ghosted.
 
 If possible, please answer also directly to me (I'm not on this list).
 
 Are you maintaining ZPsychopg? If not, the maintainers might be able to 
 help...

No, actually we've a db application which makes a lot of use of zpsycopg
for insert/updates, not only for select, and we stumbled on this
problem. We're working with Federico Di Gregorio (psycopg mantainer) in
order to solve the problem.

 cheers,
 
 Chris - who learnt a whole lot more about ZODB and ZODB caching when 
 solving this kind of problem in ZOracleDA ;-)

I suspect I will have to learn something in the hard way too :)

 -- 
 Simplistix - Content Management, Zope  Python Consulting
- http://www.simplistix.co.uk

Thanks for your help

Regards
Marco

-- 
Marco Bizzarri - Amministratore Delegato - Icube S.r.l.
Sede:   Via Ridolfi 15 - 56124 Pisa (PI), Italia 
E-mail: [EMAIL PROTECTED]   WWW: www.icube.it   
Tel:(+39) 050 97 02 07  Fax: (+39) 050 31 36 588


pgp0.pgp
Description: PGP signature
___
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: [ZODB-Dev] Re: BTrees strangeness (was [Zope-dev] Zope 2.X BIG Session problems - blocker - our site dies - need help of experience Zope developer, please)

2004-03-05 Thread Chris McDonough
On Fri, 2004-03-05 at 09:15, [EMAIL PROTECTED] wrote:
 Installed. I had to install new zope instance first, then import
 old content via zexp  recreate manually all admins. Because when you 
 change the running zope config in Zope 2.7.0 it has no impact on 
 temp_folder - Sessions.fs is not created when the temporary storage
 was already in place.

Wow.  Sorry about that.  I would have thought changing out the storage
would just work, but I didn't try it myself.

 Lets see, next test will be on Monday, many users come only on working 
 days.
 
 I also got many complatins from customer, so I wrote a test suite
 which is logging to a site each 2 minutes, and if there are problem,
 it sends emails to all of admins, so they come and restart zope. 

Ouch.

 
 With prev. Transience, when this keyError appear, it was seen
 only by 1,2,3 users. With new Transience, when error starts
 to appear, nobody is able to see any page which uses Session - 
 all sessions became broken.

Ouch again.

 
 I am monitoring site now, and will tell you about the results.

OK, many thanks!

- C



___
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] Image.tag() no longer publishable?

2004-03-05 Thread Andy McKay
Paul Winkler wrote:
yeah, it might be an unpopular change. I dunno.
Anything that forces me to use better style is OK with me ;-)
Ideally we need to set a zope config option that states what HTML 
standard is being rendered too, then all parts that render HTML use 
those conventions. We've found this in Plone where some underlying bit 
of code somewhere in the bowels renders a query string incorrectly for 
example.

Not a trivial job though and probably not worth it. Would also give 
people who run virtual hosting with multiple sites a bit of a fit.
--
  Andy McKay
  ClearWind Consulting
  http://www.clearwind.ca

___
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] Question about _v_ attributes and database connections

2004-03-05 Thread Dieter Maurer
Marco Bizzarri wrote at 2004-3-5 09:18 +0100:
We're trying to tackle a problem in hanging connections in ZPsycopg.
However, I would like to have some information about the functioning of
the _v_ attributes, and the cache management. In particular:

1) where is the code which handles the _v_ attributes (I like to look at
the source code, you know ;))

in ZODB/cPersistence.c.

2) where is the code which handles the caching of the objects?

in ZODB/cPickleCache.c

3) is it possible to disable caching of some object?

No, but you can (in most cases) flush it again
by calling its _p_deactivate method.

You can always do it by assigning None to _p_changed, but this
is highly unsafe. You should not do it (unless you really know
what you are doing).

4) when an _v_ attribute is removed, what code of the object/attribute
itself is called?

The object's __del__ method (if defined).
This means the object that was bound to the _v_ attribute
not the object that had the _v_attribute.

-- 
Dieter

___
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 )