Merge lp:~stub/launchpad/bug-373837 into lp:launchpad

Proposed by Stuart Bishop
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~stub/launchpad/bug-373837
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~stub/launchpad/bug-373837
Reviewer Review Type Date Requested Status
Brad Crittenden (community) Approve
Review via email: mp+9759@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

In my fix for Bug #373837 I was overzealous and logged TransactionRollbackErrors as a soft OOPS when they occurred in addition to DisconnectionErrors. This isn't desirable, as this is a normal occurrence (SERIALIZATION exceptions cannot be avoided and the app is required to handle them). We could just ignore these OOPSes, but they look identical to a case we *do* need to know about - when our retry attempts fail too many times and we give up.

Revision history for this message
Stuart Bishop (stub) wrote :

This branch will close Bug #409907

Revision history for this message
Brad Crittenden (bac) wrote :

Easy fix, nice branch.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/webapp/publication.py'
2--- lib/canonical/launchpad/webapp/publication.py 2009-07-28 13:05:05 +0000
3+++ lib/canonical/launchpad/webapp/publication.py 2009-08-06 12:23:39 +0000
4@@ -475,12 +475,9 @@
5 # the publication, so there's nothing we need to do here.
6 pass
7
8- # Log a soft OOPS for DisconnectionErrors and
9- # TransactionRollbackErrors, as per Bug #373837. We need to do
10- # this before we re-raise the excaptionsas a Retry.
11- if isinstance(
12- exc_info[1],
13- (DisconnectionError, TransactionRollbackError)):
14+ # Log a soft OOPS for DisconnectionErrors as per Bug #373837.
15+ # We need to do this before we re-raise the excaptionsas a Retry.
16+ if isinstance(exc_info[1], DisconnectionError):
17 getUtility(IErrorReportingUtility).raising(exc_info, request)
18
19 def should_retry(exc_info):
20
21=== modified file 'lib/canonical/launchpad/webapp/tests/test_publication.py'
22--- lib/canonical/launchpad/webapp/tests/test_publication.py 2009-07-28 13:05:05 +0000
23+++ lib/canonical/launchpad/webapp/tests/test_publication.py 2009-08-06 12:23:39 +0000
24@@ -74,27 +74,24 @@
25
26 # Ensure that OOPS reports are generated for database
27 # disconnections, as per Bug #373837.
28- for exception in (DisconnectionError, TransactionRollbackError):
29- request = LaunchpadTestRequest()
30- publication = WebServicePublication(None)
31- da.set_request_started()
32- try:
33- raise exception('Fake')
34- except exception:
35- self.assertRaises(
36- Retry,
37- publication.handleException,
38- None, request, sys.exc_info(), True)
39- da.clear_request_started()
40- next_oops = error_reporting_utility.getLastOopsReport()
41-
42- # Ensure the OOPS mentions the correct exception
43- self.assertNotEqual(repr(next_oops).find(exception.__name__), -1)
44-
45- # Ensure that it is different to the last logged OOPS.
46- self.assertNotEqual(repr(last_oops), repr(next_oops))
47-
48- last_oops = next_oops
49+ request = LaunchpadTestRequest()
50+ publication = WebServicePublication(None)
51+ da.set_request_started()
52+ try:
53+ raise DisconnectionError('Fake')
54+ except DisconnectionError:
55+ self.assertRaises(
56+ Retry,
57+ publication.handleException,
58+ None, request, sys.exc_info(), True)
59+ da.clear_request_started()
60+ next_oops = error_reporting_utility.getLastOopsReport()
61+
62+ # Ensure the OOPS mentions the correct exception
63+ self.assertNotEqual(repr(next_oops).find(exception.__name__), -1)
64+
65+ # Ensure that it is different to the last logged OOPS.
66+ self.assertNotEqual(repr(last_oops), repr(next_oops))
67
68
69 def test_suite():