Opened 6 years ago

Closed 6 years ago

#4411 defect closed fixed (fixed)

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
(github, coverage, patch, buildbot, log)


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 6 years ago by honeyman

  • Type changed from enhancement to defect

comment:2 Changed 6 years ago by exarkun

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

refs #4411

comment:3 Changed 6 years ago by exarkun

  • Keywords review added
  • Owner jknight deleted

comment:4 Changed 6 years ago by itamar

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

comment:5 Changed 6 years ago by exarkun

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

comment:6 Changed 6 years ago by exarkun

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

refs #4411

comment:7 Changed 6 years ago by exarkun

  • Resolution set to fixed
  • Status changed from new to closed

(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 5 years ago by <automation>

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