Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amp.Command.requiresAnswer isn't respected in the failure case, returning failing Deferreds from callRemote when the caller expects none #9756

Closed
twisted-trac opened this issue Jan 9, 2020 · 3 comments

Comments

@twisted-trac
Copy link

glyph's avatar @glyph reported
Trac ID trac#9756
Type defect
Created 2020-01-09 00:46:27Z

In AMP, there are two kinds of invocations of callRemote: the normal one, where you get a Deferred back and then you have to handle the error from it, and fire-and-forget, where you specify requiresAnswer = False and you get None back, and you don't care if that specific invocation failed.

The distinction is semantically important because unhandled errors on Deferreds get logged, which means if you do this:

#!py
class MyNeatCommand(Command):
    requiresAnswer = False
    ...

self.callRemote(MyNeatCommand)

you can't know a-priori whether the connection is closed or not, so you need this nasty workaround instead:

#!py
result = self.callRemote(MyNeatCommand)
if result is not None:
    result.addErrback(lambda ignored: None)

unless you want your logs to fill up with unexplained ConnectionDone errors.

Instead, BoxDispatcher._sendBoxCommand ought to check requiresAnswer before it checks _failAllReason, and never return a failing Deferred when none is expected.

Searchable metadata
trac-id__9756 9756
type__defect defect
reporter__glyph glyph
priority__high high
milestone__None None
branch__ 
branch_author__ 
status__closed closed
resolution__fixed fixed
component__core core
keywords__None None
time__1578530787791441 1578530787791441
changetime__1579025930222284 1579025930222284
version__None None
owner__glyph glyph

@twisted-trac
Copy link
Author

glyph's avatar @glyph commented

#1218

@twisted-trac
Copy link
Author

wsanchez's avatar @wsanchez set owner to @glyph

reviewed

@twisted-trac
Copy link
Author

wsanchez's avatar @wsanchez set status to closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants