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

CI run against Twisted trunk is failing #16728

Closed
matrixbot opened this issue Dec 21, 2023 · 1 comment · Fixed by #17036
Closed

CI run against Twisted trunk is failing #16728

matrixbot opened this issue Dec 21, 2023 · 1 comment · Fixed by #17036

Comments

@matrixbot
Copy link
Collaborator

matrixbot commented Dec 21, 2023

See https://github.com/element-hq/synapse/actions/runs/8643480271

@matrixbot matrixbot changed the title Dummy issue CI run against Twisted trunk is failing Dec 22, 2023
@matrixbot matrixbot reopened this Dec 22, 2023
@spaetz
Copy link

spaetz commented Jan 19, 2024

For ease of access:
The failure in the linked CI run is in task mypy:

synapse/http/server.py:157: error: "ITransport" has no attribute "abortConnection"; maybe "loseConnection"?  [attr-defined]
synapse/http/proxy.py:264: error: Item "ITransport" of "Optional[ITransport]" has no attribute "abortConnection"  [union-attr]
synapse/http/proxy.py:264: error: Item "None" of "Optional[ITransport]" has no attribute "abortConnection"  [union-attr]
synapse/http/site.py:152: error: Item "ITransport" of "Optional[ITransport]" has no attribute "abortConnection"  [union-attr]
synapse/http/site.py:152: error: Item "None" of "Optional[ITransport]" has no attribute "abortConnection"  [union-attr]
Found 5 errors in 3 files (checked 870 source files)

Some more clueless rooting in source (https://github.com/twisted/twisted/blob/d827ff43cc97495f54cf14d0b65a7af42f52c161/src/twisted/internet/interfaces.py#L2129)

ITransport is an abstract interface which indeed does not have a method "abortConnection" defined. It is implemented by 2 other classes ITCPTransport which does define abortConnection and by IUNIXTransport (a Transport for stream-oriented unix domain connections.) which does not.

So indeed, we can not be sure that abortConnection exists until we are sure that request.transport is of the ITCPTransport kind (which it will always be in synapse, I guess???)

To make mypy happy, one would either have to

  1. silence the warnings to the calls to abortConnection(), or
  2. test explicitely that we have a request.transport is a ITCPTransport subclass to make sure it is of the right kind, or simply
  3. check for the existance of the abortConnection method.

erikjohnston added a commit that referenced this issue Apr 11, 2024
`ITransport.abortConnection` isn't a thing, but
`HTTPChannel.forceAbortClient` calls it, so lets just use that

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

Successfully merging a pull request may close this issue.

2 participants