Re: [Zope-dev] Conflict errors on startup, revisited

2005-02-25 Thread Chris Withers
Tim Peters wrote:
I'm not really happy with that, because I have no theory for how ZEO
client cache files _get_ out of synch. 
The most common one for me is connecting a ZEO client to one storage 
server (say a dev one) and then changing the config to connect to 
another storage server (say a staging one) without making sure the cache 
files are gone. That seems ot do it most time, and I'm sure I've got 
POSKeyErrors and all manner of other weirdness too.

My workaround is never to use persistent client caches on clients that 
I'm likely to connect to different servers. This seems a shame, I wish 
there was some kind of safety check that ZEO could do to go wait, these 
caches are insane, they don't even apply to the server you're connecting to

cheers,
Chris
--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] ZCatalog getObject broken

2005-02-25 Thread Roché Compaan
Last year in March the following checkin was made that changed
ZCatalog's getObject to use restrictedTraverse instead of
unrestrictedTraverse. See:

http://mail.zope.org/pipermail/zope-checkins/2004-March/026846.html

In my opininion this is wrong, and just cost me a good three hours to
figure out why big parts of one of our apps broke after an upgrade to
Zope 2.7.3. What's worse is that there is nowhere a trace of this change
in HISTORY.txt or CHANGES.txt.

Anybody with a site structure that has less restrictive access deeper
into the site would agree that getObject should do an
unrestrictedTraverse. restrictedTraverse returns None as soon as it
traverses an object a user does not have access to, regardless if the
user has access to the object referred to by the full path. To
illustrate imagine the following:

You have a site with a folder containg documents at '/documents'. Inside
that folder you have a whole bunch of documents where users have a local
role of owner to give them permission to access only their own
documents. You use a Catalog query to get the list of documents
belonging to a particular user and want to use getObject to retrieve the
objects found. But, it won't work because restrictedTraverse already
fails when traversing the 'documents' folder.

I would propose that getObject does an unrestrictedTraverse of the path
and then checks if the user has permission to access that the object.

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

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Conflict errors on startup, revisited

2005-02-25 Thread Dieter Maurer
Paul Winkler wrote at 2005-2-24 15:16 -0500:
 ...
Twiddling around with some old suggestions from Dieter
Maurer (see
http://aspn.activestate.com/ASPN/Mail/Message/Zope-CMF/1978842 ),
I added a _p_jar.sync() where he suggested - right
before the final except: in initialize_product().
No joy.  

Note that the database is initialized in a separate connection
-- in case it is empty.
This may cause ConflictErrors in the primary connection.


-- 
Dieter
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Conflict errors on startup, revisited

2005-02-25 Thread Dieter Maurer
Paul Winkler wrote at 2005-2-24 14:29 -0500:
This is a topic that comes up occasionally, but since the symptom
seems to be rare and hard to provoke, it never gets resolved.
Well it's biting me again and I'm determined to fix it, but
would like some input from the list.

I know that ZopeProfiler can cause such ConflictErrors
and (what is more) why it does this.

ZopeProfiler (like some other products) wants to install
itself in Control_Panel.

Because, this requires a database connection
and because App.ProductContext.ProductContest tries
hard to hide its application object,
ZopeProfiler opens a new one, modifies Control_Panel
and commits the transaction and then closes its connection.

Such modifications via a second ZODB connection
can cause unexpected (and puzzling) ConflictError on
startup.

The next ZopeProfiler version will access
ProductContext.__app instead (using the mangled name).

-- 
Dieter
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] ZCatalog getObject broken

2005-02-25 Thread Dieter Maurer
Roché Compaan wrote at 2005-2-25 17:22 +0200:
Last year in March the following checkin was made that changed
ZCatalog's getObject to use restrictedTraverse instead of
unrestrictedTraverse. See:

http://mail.zope.org/pipermail/zope-checkins/2004-March/026846.html

In my opininion this is wrong,

I agree with you!

 ...
I would propose that getObject does an unrestrictedTraverse of the path
and then checks if the user has permission to access that the object.

I argued precisely this approach with the person who made the
change. I had the impression that I have convinced him -- but
apparently, he did not change the code accordingly :-(

Maybe, a bug report to the collector will help?

   http://www.zope.org/Collectors/Zope

-- 
Dieter
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Conflict errors on startup, revisited

2005-02-25 Thread Tim Peters
 ZODB.POSException.ConflictError: database conflict error (
 serial this txn started with 0x035b25f36751f988 2005-02-10 18:59:24.215675,
 serial currently committed 0x035b743c6d186822 2005-02-24 17:00:25.569220)
 
[Dieter Maurer]
 Where is the oid in this ConflictError report?
 It is vital information to analyse which object causes the problem...

I don't know. I reformatted Paul's traceback to line up the timestamps
for easier reading, but there was no oid in the original either. 
There wouldn't be, either, if no oid was passed to the ConflictError
constructor.  ConflictError.__str__ only includes info for the stuff
it was told about:

def __str__(self):
extras = []
if self.oid:
extras.append(oid %s % oid_repr(self.oid))
if self.class_name:
extras.append(class %s % self.class_name)
if self.serials:
current, old = self.serials
extras.append(serial this txn started with %s %
  readable_tid_repr(old))
extras.append(serial currently committed %s %
  readable_tid_repr(current))
if extras:
return %s (%s) % (self.message, , .join(extras))
else:
return self.message

In Paul's case, the ConflictError occurred on the ZEO server, but the
traceback came from the ZEO client (just raising the Exception object
the ZEO server  passed to it).  There's no way then to guess what the
traceback might have looked like on the ZEO server side (b!). 
Perhaps looking at the ZEO server log would have helped.
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Conflict errors on startup, revisited

2005-02-25 Thread Paul Winkler
On Thu, Feb 24, 2005 at 02:29:50PM -0500, Paul Winkler wrote:
 This is a topic that comes up occasionally, but since the symptom
 seems to be rare and hard to provoke, it never gets resolved.
 Well it's biting me again and I'm determined to fix it,
...

And since my ConflictError turned out to be merely caused by
a borked ZEO client cache, I've given up on the hunt ... again :-\

For all I know, ZEO cache may have been the cause of my previous 
run-ins with ConflictError on startup too.


-PW

-- 

Paul Winkler
http://www.slinkp.com
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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: ZCatalog getObject broken

2005-02-25 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Andreas Jung wrote:
|
|
| --On Freitag, 25. Februar 2005 20:21 Uhr +0100 Dieter Maurer
| [EMAIL PROTECTED] wrote:
|
| Roché Compaan wrote at 2005-2-25 17:22 +0200:
|
| Last year in March the following checkin was made that changed
| ZCatalog's getObject to use restrictedTraverse instead of
| unrestrictedTraverse. See:
|
| http://mail.zope.org/pipermail/zope-checkins/2004-March/026846.html
|
| In my opininion this is wrong,
|
|
| I agree with you!
|
| ...
| I would propose that getObject does an unrestrictedTraverse of the path
| and then checks if the user has permission to access that the object.
|
|
| I argued precisely this approach with the person who made the
| change. I had the impression that I have convinced him -- but
| apparently, he did not change the code accordingly :-(
|
| Maybe, a bug report to the collector will help?
|
|http://www.zope.org/Collectors/Zope
|
|
| Best to include a patch as well :-)
And a new test which fails under the current code, but succeeds with the
patch. ;)
Tres.
- --
===
Tres Seaver[EMAIL PROTECTED]
Zope Corporation  Zope Dealers   http://www.zope.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCH50UGqWXf00rNCgRAradAJ9/v/nU3iZEALYK+7hI2NYZCZbi0ACggAxm
l4LfqI3+RYCI8VRHV9cz0rU=
=4SWg
-END PGP SIGNATURE-
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )