matrix-org / sygnal

Sygnal: reference Push Gateway for Matrix
Apache License 2.0
166 stars 148 forks source link

Tests for HTTP Proxy Support #142

Closed reivilibre closed 4 years ago

reivilibre commented 4 years ago

This will currently cause a noisy exception chain in the testing; this was inherited from Synapse but Synapse doesn't log in tests for some reason…

For Synapse, see this log from this build.

I don't know how to solve it, though.

But at least it tests and passes — but for now, I'm knackered.

reivilibre commented 4 years ago

Need to investigate

Traceback (most recent call last):

  File "/workdir/sygnal/http.py", line 265, in _handle_dispatch

    result = await pushkin.dispatch_notification(notif, d, context)

  File "/workdir/sygnal/notifications.py", line 164, in dispatch_notification

    return await self._dispatch_notification_unlimited(n, device, context)

  File "/workdir/sygnal/apnspushkin.py", line 279, in _dispatch_notification_unlimited

    log, span, device, shaved_payload, prio

  File "/workdir/sygnal/apnspushkin.py", line 210, in _dispatch_request

    response = await self._send_notification(request)

TypeError: object function can't be used in 'await' expression

in CI log, sounds ominous.

reivilibre commented 4 years ago
2020-08-03 18:58:08,660 [244] ERROR tests.twisted_test_helpers Exception writing to protocol: 'NoneType' object has no attribute 'bio_read'
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/twisted/protocols/tls.py", line 274, in _flushReceiveBIO
    bytes = self._tlsConnection.recv(2 ** 15)
  File "/usr/local/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1809, in recv
    self._raise_ssl_error(self._ssl, result)
  File "/usr/local/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1650, in _raise_ssl_error
    raise ZeroReturnError()
OpenSSL.SSL.ZeroReturnError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/workdir/tests/twisted_test_helpers.py", line 155, in flush
    self.other.dataReceived(to_write)
  File "/usr/local/lib/python3.7/site-packages/twisted/internet/endpoints.py", line 132, in dataReceived
    return self._wrappedProtocol.dataReceived(data)
  File "/workdir/sygnal/helper/proxy/connectproxyclient_twisted.py", line 201, in dataReceived
    return self.wrapped_protocol.dataReceived(data)
  File "/usr/local/lib/python3.7/site-packages/twisted/protocols/tls.py", line 330, in dataReceived
    self._flushReceiveBIO()
  File "/usr/local/lib/python3.7/site-packages/twisted/protocols/tls.py", line 285, in _flushReceiveBIO
    self._tlsShutdownFinished(None)
  File "/usr/local/lib/python3.7/site-packages/twisted/protocols/tls.py", line 378, in _tlsShutdownFinished
    self._flushSendBIO()
  File "/usr/local/lib/python3.7/site-packages/twisted/protocols/tls.py", line 252, in _flushSendBIO
    bytes = self._tlsConnection.bio_read(2 ** 15)
AttributeError: 'NoneType' object has no attribute 'bio_read'

2020-08-03 18:58:08,662 [244] INFO  tests.twisted_test_helpers <twisted.protocols.tls.TLSMemoryBIOProtocol object at 0x7fdc0b482c90>-><twisted.internet.endpoints._WrappingProtocol object at 0x7fdc0b482890>: b"\x17\x03\x01\x00$y3>\xbb\x02\xb4\xa8h\r$A\x08&0\xe2\xd8\x87y\xe7>C\xfd9i\x16\x88lC\x03\x83\xcd\xe7\x03\x10\x852\x17\x03\x01\x00$\xe0'\x02\x89'\xc3\x9cv\xaa6\xa3x\xc3P\x95\x97\x1b\xcc\x88\xf5\xd1\xcb\x89\xf4\xf9\xe4=):o\x12\xdd\xacC\x19>\x15\x03\x01\x00$w\x8a\xb6\xa6\x1f\xa4N=5f\xcbd?\x89P\xd6A\x8cPU2.\xd1\xbf]\xe2-u\xec0\xe2\x16\x9cGp\xd0"
2020-08-03 18:58:08,662 [244] ERROR tests.twisted_test_helpers Exception writing to protocol: 'NoneType' object has no attribute 'write'

Traceback (most recent call last):
  File "/workdir/tests/twisted_test_helpers.py", line 155, in flush
    self.other.dataReceived(to_write)
  File "/usr/local/lib/python3.7/site-packages/twisted/internet/endpoints.py", line 132, in dataReceived
    return self._wrappedProtocol.dataReceived(data)
  File "/workdir/sygnal/helper/proxy/connectproxyclient_twisted.py", line 205, in dataReceived
    return self.http_setup_client.dataReceived(data)
  File "/usr/local/lib/python3.7/site-packages/twisted/protocols/basic.py", line 579, in dataReceived
    why = self.rawDataReceived(data)
  File "/usr/local/lib/python3.7/site-packages/twisted/web/http.py", line 647, in rawDataReceived
    self.handleResponsePart(data)
  File "/usr/local/lib/python3.7/site-packages/twisted/web/http.py", line 615, in handleResponsePart
    self.__buffer.write(data)
AttributeError: 'NoneType' object has no attribute 'write'

2020-08-03 18:58:08,664 [244] INFO  tests.twisted_test_helpers <twisted.internet.endpoints._WrappingProtocol object at 0x7fdc0b482890>-><twisted.protocols.tls.TLSMemoryBIOProtocol object at 0x7fdc0b482c90>: b'\x15\x03\x01\x00$\x1cV\xd0 \x8a\xd8\x1a\xa0$\x9b\xb0\xe2\x1d+\x05r\xa1\xbe\xb6:\xb2\xe4\xc4\x82a\x9a\x9c\xe3\x06\x94\x9f\x1b\x8cL\x97\x9d'
2020-08-03 18:58:08,664 [244] INFO  tests.twisted_test_helpers FakeTransport: loseConnection(None)
2020-08-03 18:58:08,664 [244] INFO  tests.twisted_test_helpers FakeTransport: Delaying disconnect until buffer is flushed

^ is the noisy error

I appear to have made the log very very noisy indeed, should probably look into this.

EDIT: Synapse has this problem too, just the logging in tests is silent there...