Merge lp:~jameinel/launchpad/suppress-generator-exit-726985 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Benji York |
Approved revision: | no longer in the source branch. |
Merged at revision: | 12556 |
Proposed branch: | lp:~jameinel/launchpad/suppress-generator-exit-726985 |
Merge into: | lp:launchpad |
Diff against target: |
84 lines (+43/-9) 2 files modified
lib/launchpad_loggerhead/app.py (+10/-2) lib/launchpad_loggerhead/tests.py (+33/-7) |
To merge this branch: | bzr merge lp:~jameinel/launchpad/suppress-generator-exit-726985 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Benji York (community) | code | Approve | |
Review via email: mp+52414@code.launchpad.net |
Commit message
[r=benji] [bug=726985] Suppress bogus OOPS entries when clients disconnect early on streamed pages.
Description of the change
Adding another kind of exception for Loggerhead to treat as a non-OOPS.
There are only a few pages that do streamed bodies, but when one of those is stopped early, we get a GeneratorExit exception (when the generator loses its last reference.)
The test for this requires CPython's refcounting semantics (throw a GeneratorExit exception as soon as we call 'del app'). I'm pretty sure this is safe for Launchpad, but I figured I would mention it.
GeneratorExit itself never really cares any other context, so I don't think we could say that there is any reason to decide we really do want an oops here, rather than just always suppressing it. If we get 1 more of these, we should probably unify their logging, etc a bit. But for right now, 2 didn't seem to imply a trend.
Note that I was unable to actually reproduce the failure with custom "GET ../download/" and stopping early. So if we want, we can put this off until we actually see this being the #1 OOPS failure. Though according to wgrant, it was.
This branch looks good.
> The test for this requires CPython's refcounting semantics (throw a
> GeneratorExit exception as soon as we call 'del app'). I'm pretty sure
> this is safe for Launchpad, but I figured I would mention it.
Yeah, I agree that it's safe, especially because the failure mode would
result in a test failing (always good) while the app would continue to
work correctly.
> Note that I was unable to actually reproduce the failure with custom
> "GET ../download/" and stopping early. So if we want, we can put this
> off until we actually see this being the #1 OOPS failure. Though
> according to wgrant, it was.
I am a little concerned about not being unable to trigger the behavior
we're trying to remedy "for real". This may indicate that we're not
really fixing the problem, but the change as given appears to be a pure
win, so there's no reason not to do it.