[Zope-dev] ConflictError shouldn't subclass Exception
Hi All, Chris McDonough wrote: Is this the number of log messages that indicate a conflict error occurred (e.g. x conflict errors since DATE messages in the event log) or the number of conflict errors that are retried more than three times and thus make it out to the app user? I'm guessing the former. I'm interested to see that this causes everyone the same level of confusion ;-) I'll reply to the other message about this though... The real reason they're called errors is only because they're implemented as Python exceptions. They are implemented as exceptions because it was the easiest mechanism to use (exceptions are already built into Python). Interestingly, you can raise things that don't subclass Exception in python. This was discussed before, and I firmly agree with, that zodb conflicts should _not_ sublcass exception. That way, there's less chance of them being caught by inexperienced programmers putting in try: except Exception: 's. How would we go about making this change? The Zope conflict exception catching code is written in such a complicated way (and without the benefit of any automated tests) that tracking that down could take an entire day which I don't have to burn ATM. So I'm afraid the status quo will prevail until someone gets so indignant about it that they either pay for it to be fixed or fix it themselves. Apologies for that. :-( Okay, I'll bite, I might well be able to stump up the paid time on this if you guys can help me justify it as a performance improvement :-) I hope I can count on a bit of moral and intellectual support if I manage to make this happen! 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] ConflictError shouldn't subclass Exception
2005/11/24, Chris Withers [EMAIL PROTECTED]: Interestingly, you can raise things that don't subclass Exception in python. This was discussed before, and I firmly agree with, that zodb conflicts should _not_ sublcass exception. That way, there's less chance of them being caught by inexperienced programmers putting in try: except Exception: 's. How would we go about making this change? class my_own_exception: pass try: raise my_own_exception() except: print Doesn't help against inexperienced programmers. sadly You can even raise a string, which is accidently done in zope2 and where my with provided solution and unit test is pending. It is better to beat people using except: without good reasons. Patrick ___ 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] ConflictError shouldn't subclass Exception
On Nov 25, 2005, at 2:25 PM, Patrick Gerken wrote: 2005/11/24, Chris Withers [EMAIL PROTECTED]: Interestingly, you can raise things that don't subclass Exception in python. This was discussed before, and I firmly agree with, that zodb conflicts should _not_ sublcass exception. That way, there's less chance of them being caught by inexperienced programmers putting in try: except Exception: 's. How would we go about making this change? class my_own_exception: pass try: raise my_own_exception() except: print Doesn't help against inexperienced programmers. sadly You can even raise a string, which is accidently done in zope2 and where my with provided solution and unit test is pending. It is better to beat people using except: without good reasons. Yup. Lots of talk has been going on on python-dev about putting exceptions into multiple hierarchies lately, which would solve the problem at the right level. - C ___ 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] ConflictError shouldn't subclass Exception
Chris Withers wrote at 2005-11-24 19:34 +: ... and I firmly agree with, that zodb conflicts should _not_ sublcass exception. -1 That way, there's less chance of them being caught by inexperienced programmers putting in try: except Exception: 's. Most people that use an unrestricted try ... except ... use try: ... except: ... and not try: ... except Exception: ..., thus your proposal will not help much... How would we go about making this change? Do not do it at all. -- 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] ConflictError in BTreeFolder2
Are these patches available anywhere? Have you let Shane know? Chris Florent Guillaume wrote: FYI: I've fixed BTreeFolder2 to properly re-raise ConflictError in _delObject and not swallow it during beforeDelete cleanups. This is the same fix that was done in ObjectManager. Florent ___ 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] ConflictError in BTreeFolder2
FYI: I've fixed BTreeFolder2 to properly re-raise ConflictError in _delObject and not swallow it during beforeDelete cleanups. This is the same fix that was done in ObjectManager. Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:[EMAIL PROTECTED] ___ 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] ConflictError
Hi all, i have a little problem with the following log-entry in my logfile. 2003-03-28T10:09:18 INFO(0) ZODB conflict error at /foo/bar/tab_kopf (1 conflicts since startup at 2003-03-28T10:09:03). After searching through several mailinglists i found that this error seem to occur when using sessions, i'am right ? But my problem is, that tab_kopf is a ImageFile defined in my Product. tab_kopf = ImageFile('www/tab_kopf.gif',globals()) I dont understand how there could be a ConflictError on a Image ? I hope someone could give me a tip whats going on. Thanks in advance, as ___ 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] ConflictError
On Fri, 2003-03-28 at 06:15, Andre Schubert wrote: Hi all, i have a little problem with the following log-entry in my logfile. 2003-03-28T10:09:18 INFO(0) ZODB conflict error at /foo/bar/tab_kopf (1 conflicts since startup at 2003-03-28T10:09:03). After searching through several mailinglists i found that this error seem to occur when using sessions, i'am right ? But my problem is, that tab_kopf is a ImageFile defined in my Product. tab_kopf = ImageFile('www/tab_kopf.gif',globals()) I dont understand how there could be a ConflictError on a Image ? I hope someone could give me a tip whats going on. Conflict Errors are things that can happen during the normal course of a Zope operation. They happen whenever a request tries to read or write an object for the first time in a request (transaction) that started before another request (transaction) that already modified such object. Zope automatically restarts the conflicting transaction, so the only visible effect is a little delay before the transaction finishes. You should only worry if you're seeing a copious amount of such messages, or if you are seeing these errors in the browser, which happens after zope retries the transaction 3 times and still gets a conflict error, in which case it gives up. Cheers, Leo -- Ideas don't stay in some minds very long because they don't like solitary confinement. ___ 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] ConflictError
Andre Schubert wrote at 2003-3-28 10:15 +0100: i have a little problem with the following log-entry in my logfile. 2003-03-28T10:09:18 INFO(0) ZODB conflict error at /foo/bar/tab_kopf (1 conflicts since startup at 2003-03-28T10:09:03). After searching through several mailinglists i found that this error seem to occur when using sessions, i'am right ? But my problem is, that tab_kopf is a ImageFile defined in my Product. tab_kopf = ImageFile('www/tab_kopf.gif',globals()) I dont understand how there could be a ConflictError on a Image ? I hope someone could give me a tip whats going on. Please file a feature request to http://collector.zope.org/Zope. Zope should distinguish between Write and Read conflict errors. You can try the necessary modification yourself. Patch for Zope 2.6.1 attached. You probably see a Database read conflict error. It may happen for reading foo, bar or tab_kopf. The patch will give you hints what object got this error. Dieter --- Zope/App/startup.py~ 2003-02-28 16:59:25.0 +0100 +++ Zope/App/startup.py 2003-03-17 11:13:28.0 +0100 @@ -140,9 +140,9 @@ global conflict_errors conflict_errors = conflict_errors + 1 method_name = REQUEST.get('PATH_INFO', '') -err = ('ZODB conflict error at %s ' +err = ('ZODB conflict error at %s: %s' '(%s conflicts since startup at %s)') -LOG(err % (method_name, conflict_errors, startup_time), +LOG(err % (method_name, str(v), conflict_errors, startup_time), INFO, '') LOG('Conflict traceback', BLATHER, '', error=sys.exc_info()) raise ZPublisher.Retry(t, v, traceback)
[Zope-dev] ConflictError
Hi, who can tell me a story about the following error. thanks as 2000-10-04T15:49:35 INFO(0) Z2 CONFLICT Competing writes at, /Management/Geyer/Cluster_1/Verstaerker_1/Modem_7/chart_images Traceback (innermost last): File /usr/share/zope_2.2/Zope-2.2.0-src/lib/python/ZPublisher/Publish.py, line 175, in publish File /usr/share/zope_2.2/Zope-2.2.0-src/lib/python/Zope/__init__.py, line 235, in commit File /usr/share/zope_2.2/Zope-2.2.0-src/lib/python/ZODB/Transaction.py, line 251, in commit File /usr/share/zope_2.2/Zope-2.2.0-src/lib/python/ZODB/Connection.py, line 267, in commit ConflictError: yƤ ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )