Opened 10 years ago

Closed 10 years ago

#4411 defect closed fixed (fixed)

twisted.web._auth.wrapper causes an "Unhandled error in Deferred"

Reported by: Alex Owned by:
Priority: normal Milestone:
Component: web Keywords:
Cc: Branch: /branches/guard-logout-on-error-4411
branch-diff, diff-cov, branch-cov, buildbot


Whenever a deferred without any errbacks gets a Failure, the "Unhandled error in Deferred" warning is unconditionally generated.

Whenever an http.Request.notifyFinish() method is called, a new deferred is generated (rather than, eg., some common one is used). It is a duty of caller to add the proper errback to this deferred, to handle a scenario if the connection is suddenly dropped. If the errback is not added, the "Unhandled error in Deferred" warning is generated.

One of the built-in callers of notifyFinish (and in fact, at the moment, the only one) is ResourceWrapper.render() in HTTPAuthSessionWrapper._loginSucceeded() method in twisted.web._auth.wrapper module - it adds a callback to log out, but doesn't add any errbacks.

Change History (8)

comment:1 Changed 10 years ago by Alex

Type: enhancementdefect

comment:2 Changed 10 years ago by Jean-Paul Calderone

(In [28869]) Call logout on notifyFinish errback, too.

refs #4411

comment:3 Changed 10 years ago by Jean-Paul Calderone

Keywords: review added
Owner: jknight deleted

comment:4 Changed 10 years ago by Itamar Turner-Trauring

Keywords: review removed
Owner: set to Jean-Paul Calderone
  1. Move common infrastructure for logout test into shared utility function.
  1. That's it I guess, looks good otherwise.

comment:5 Changed 10 years ago by Jean-Paul Calderone

Branch: /branches/guard-logout-on-error-4411

comment:6 Changed 10 years ago by Jean-Paul Calderone

(In [28881]) Factor common code out of test_logout and test_logoutOnError into a helper method

refs #4411

comment:7 Changed 10 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(In [28884]) Merge guard-logout-on-error-4411

Author: exarkun Reviewer: itamar Fixes: #4411

Fix a bug in twisted.web.guard.SessionWrapper which would cause it to fail to call the realm-provided logout callback if there was an error rendering the response to the request (eg the client disconnected before it was all generated).

comment:8 Changed 9 years ago by <automation>

Owner: Jean-Paul Calderone deleted
Note: See TracTickets for help on using tickets.