-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
# Twisted > 23.8.0 has a different API that accepts a clock. | ||
if twisted.version <= Version("Twisted", 23, 8, 0): | ||
return TLSMemoryBIOFactory( | ||
connection_creator, isClient=False, wrappedFactory=factory | ||
) | ||
else: | ||
return TLSMemoryBIOFactory( | ||
connection_creator, isClient=False, wrappedFactory=factory, clock=clock # type: ignore[call-arg] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did Twisted make a breaking change to TLSMemoryBIOFactory here, or are we just taking advantage of a newer API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I can't see anything in https://github.com/twisted/twisted/blob/trunk/NEWS.rst#deprecations-and-removals so assuming we're using a newer API.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't a breaking change, you don't have to provide clock
, but you do if you want our tests to pass. (Otherwise it uses the trial reactor instead of the test reactor.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sane, but I don't understand what exactly was failing and why on Twisted trunk. Could you spell it out for me?
Oh, I think I see: twisted/twisted#11996 made speedups in twisted. But as a consequence of how they did so, their tests now need to pass in a Clock explicitly. We need to do the same. |
I attempted to add more info to the description, I'm not sure it is enough though. |
Thanks! I think I was confused because the version check we added made me think there was a behaviour change in 23.8.0, rather than in twisted trunk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There's no released version so I had to do checks against the currently released version (and hope there's no 23.8.x release.... but I find that unlikely). |
Looks like the patching is causing issues... maybe a memory leak? |
This reverts commit 5dcaea6.
I kicked off a run without the patching: https://github.com/matrix-org/synapse/actions/runs/6626203043 |
Looks like the tests do fail without this change, I wonder if they pass on the commit before? |
This passed, but fails on older Twisteds, I think we should just not patch older ones then? 🤷 |
# test to patch over it. | ||
# | ||
# Use create=True for backwards compatibilty with Twisted <= 23.8.0. | ||
if twisted.version > Version("Twisted", 23, 8, 0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels janky that we check >
here and <=
to above... as if there is at 23.8.x
then it'll enable one bit of code and not the other.
It sounds like a Twisted 23.1x.0 will be out soon-ish though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can use >= 23.10.0
if we want (in both places), but it'll fail until the release is out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 23.8 is fine, just a note for completeness.
Tests passed here, now let's see if they pass on Twisted Trunk: https://github.com/matrix-org/synapse/actions/runs/6628632702 |
Let's try again: https://github.com/matrix-org/synapse/actions/runs/6630078646 |
@DMRobertson Can you take another quick look? |
server_ssl_protocol = _wrap_server_factory_for_tls( | ||
_get_test_protocol_factory() | ||
server_ssl_protocol = wrap_server_factory_for_tls( | ||
_get_test_protocol_factory(), self.reactor, sanlist=[b"DNS:test.com"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is passing in an explicit sanlist here a meaningful change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto below in the rest of this test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No: _wrap_server_factory_for_tls
defaulted to this if no sanlist
argument was provided.
Some tests are known to fail with >twisted-23.8, see [1] [1] matrix-org/synapse#16528 Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Some tests are known to fail with >twisted-23.8, see [1] [1] matrix-org/synapse#16528 Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Some tests are known to fail with >twisted-23.8, see [1] [1] matrix-org/synapse#16528 Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Some tests are known to fail with >twisted-23.8, see [1] [1] matrix-org/synapse#16528 Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Some tests are known to fail with >twisted-23.8, see [1] [1] matrix-org/synapse#16528 Signed-off-by: Petr Vaněk <arkamar@atlas.cz> Signed-off-by: Sam James <sam@gentoo.org>
Part of #16289, before fixing them we need to refactor some code first.
Twisted trunk makes a change to the
TLSMemoryBIOFactory
where the underlying protocol is changed fromTLSMemoryBIOProtocol
toBufferingTLSTransport
to improve performance of TLS code (see twisted/twisted#11989). In order to properly hook up this code we need to modify some of our test code to pass the test reactor's clock intoTLSMemoryBIOFactory
such that the global (trial) reactor isn't used by default.This is all rather annoying, especially when attempting to maintain compatible with older Twisted versions.
See https://github.com/twisted/twisted/pull/11996/files#diff-9d27cdf01b21540c6ef350193a9d44b88a3d2b322f3fbc08b95cdaac8fd50ed6R871-R874 for where Twisted does this in its own tests.