Ticket #4411 defect closed fixed

Opened 4 years ago

Last modified 4 years ago

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

Reported by: honeyman Owned by:
Priority: normal Milestone:
Component: web Keywords:
Cc: Branch: /branches/guard-logout-on-error-4411
(diff, github, buildbot, log)
Author: Launchpad Bug:


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


Changed 4 years ago by honeyman

  • type changed from enhancement to defect


Changed 4 years ago by exarkun

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

refs #4411


Changed 4 years ago by exarkun

  • keywords review added
  • owner jknight deleted


Changed 4 years ago by itamar

  • owner set to exarkun
  • keywords review removed

1. Move common infrastructure for logout test into shared utility function.

2. That's it I guess, looks good otherwise.


Changed 4 years ago by exarkun

  • branch set to /branches/guard-logout-on-error-4411


Changed 4 years ago by exarkun

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

refs #4411


Changed 4 years ago by exarkun

  • status changed from new to closed
  • resolution set to fixed

(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).


Changed 3 years ago by <automation>

  • owner exarkun deleted
Note: See TracTickets for help on using tickets.