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

Three tests failing on openSUSE rpm VMs #868

Closed
jayvdb opened this issue Nov 28, 2020 · 2 comments · Fixed by #892
Closed

Three tests failing on openSUSE rpm VMs #868

jayvdb opened this issue Nov 28, 2020 · 2 comments · Fixed by #892

Comments

@jayvdb
Copy link

jayvdb commented Nov 28, 2020

Describe the bug

Three upgrade related tests are currently failing. Any hints for what could be the cause would be appreciated.

This is occurring on the github tarballs of 0.12.3 and 0.12.1 , when run on openSUSE rpm build VM. It may go back further than that, but I havent been tracking the problem for very long.

The versions of all dependencies are given below.
I'm going through them looking for any package which isnt running and passing tests. wsproto and h11 passing.
I have tried to check that the expected minimums of dependencies are all met.
It is quite possible the versions are ahead of the expected versions.

Debugging material

[   48s] _________________ test_supported_upgrade_request[H11Protocol] __________________
[   48s] 
[   48s] protocol_cls = <class 'uvicorn.protocols.http.h11_impl.H11Protocol'>
[   48s] 
[   48s]     @pytest.mark.parametrize("protocol_cls", HTTP_PROTOCOLS)
[   48s]     def test_supported_upgrade_request(protocol_cls):
[   48s]         app = Response("Hello, world", media_type="text/plain")
[   48s]     
[   48s]         protocol = get_connected_protocol(app, protocol_cls, ws="wsproto")
[   48s]         protocol.data_received(UPGRADE_REQUEST)
[   48s]     
[   48s] >       assert b"HTTP/1.1 426 " in protocol.transport.buffer
[   48s] E       AssertionError: assert b'HTTP/1.1 426 ' in b'HTTP/1.1 400 \r\nSec-WebSocket-Version: 13\r\ncontent-length: 0\r\n\r\n'
[   48s] E        +  where b'HTTP/1.1 400 \r\nSec-WebSocket-Version: 13\r\ncontent-length: 0\r\n\r\n' = <test_http.MockTransport object at 0x7f62c2f8b820>.buffer
[   48s] E        +    where <test_http.MockTransport object at 0x7f62c2f8b820> = <uvicorn.protocols.http.h11_impl.H11Protocol object at 0x7f62c2f8b0a0>.transport
[   48s] 
[   48s] tests/protocols/test_http.py:676: AssertionError
[   48s] ______________ test_supported_upgrade_request[HttpToolsProtocol] _______________
[   48s] 
[   48s] protocol_cls = <class 'uvicorn.protocols.http.httptools_impl.HttpToolsProtocol'>
[   48s] 
[   48s]     @pytest.mark.parametrize("protocol_cls", HTTP_PROTOCOLS)
[   48s]     def test_supported_upgrade_request(protocol_cls):
[   48s]         app = Response("Hello, world", media_type="text/plain")
[   48s]     
[   48s]         protocol = get_connected_protocol(app, protocol_cls, ws="wsproto")
[   48s]         protocol.data_received(UPGRADE_REQUEST)
[   48s]     
[   48s] >       assert b"HTTP/1.1 426 " in protocol.transport.buffer
[   48s] E       AssertionError: assert b'HTTP/1.1 426 ' in b'HTTP/1.1 400 \r\nSec-WebSocket-Version: 13\r\ncontent-length: 0\r\n\r\n'
[   48s] E        +  where b'HTTP/1.1 400 \r\nSec-WebSocket-Version: 13\r\ncontent-length: 0\r\n\r\n' = <test_http.MockTransport object at 0x7f62c2fbbfa0>.buffer
[   48s] E        +    where <test_http.MockTransport object at 0x7f62c2fbbfa0> = <uvicorn.protocols.http.httptools_impl.HttpToolsProtocol object at 0x7f62c07566d0>.transport
[   48s] 
[   48s] tests/protocols/test_http.py:676: AssertionError
[   48s] _______________________ test_invalid_upgrade[WSProtocol] _______________________
[   48s] 
[   49s] protocol_cls = <class 'uvicorn.protocols.websockets.wsproto_impl.WSProtocol'>
[   49s] 
[   49s]     @pytest.mark.parametrize("protocol_cls", WS_PROTOCOLS)
[   49s]     def test_invalid_upgrade(protocol_cls):
[   49s]         def app(scope):
[   49s]             return None
[   49s]     
[   49s]         with run_server(app, protocol_cls=protocol_cls) as url:
[   49s]             url = url.replace("ws://", "http://")
[   49s]             response = requests.get(
[   49s]                 url, headers={"upgrade": "websocket", "connection": "upgrade"}, timeout=5
[   49s]             )
[   49s]             if response.status_code == 426:
[   49s]                 # response.text == ""
[   49s]                 pass  # ok, wsproto 0.13
[   49s]             else:
[   49s]                 assert response.status_code == 400
[   49s] >               assert response.text.lower().strip().rstrip(".") in [
[   49s]                     "missing sec-websocket-key header",
[   49s]                     "missing sec-websocket-version header",  # websockets
[   49s]                     "missing or empty sec-websocket-key header",  # wsproto
[   49s]                     "failed to open a websocket connection: missing "
[   49s]                     "sec-websocket-key header",
[   49s]                     "failed to open a websocket connection: missing or empty "
[   49s]                     "sec-websocket-key header",
[   49s]                 ]
[   49s] E               AssertionError: assert '' in ['missing sec-websocket-key header', 'missing sec-websocket-version header', 'missing or empty sec-websocket-key heade... missing sec-websocket-key header', 'failed to open a websocket connection: missing or empty sec-websocket-key header']
[   49s] E                +  where '' = <built-in method rstrip of str object at 0x7f62c556f2f0>('.')
[   49s] E                +    where <built-in method rstrip of str object at 0x7f62c556f2f0> = ''.rstrip
[   49s] E                +      where '' = <built-in method strip of str object at 0x7f62c556f2f0>()
[   49s] E                +        where <built-in method strip of str object at 0x7f62c556f2f0> = ''.strip
[   49s] E                +          where '' = <built-in method lower of str object at 0x7f62c556f2f0>()
[   49s] E                +            where <built-in method lower of str object at 0x7f62c556f2f0> = ''.lower
[   49s] E                +              where '' = <Response [400]>.text

Environment

  • Running uvicorn 0.12.3 with CPython 3.8.6 on Linux
[   16s] now installing cumulated packages
[   17s] Preparing...                          ########################################
[   17s] Updating / installing...
[   17s] system-user-root-20190513-1.21        ########################################
[   17s] filesystem-15.5-34.1                  ########################################
[   17s] glibc-2.32-3.1                        ########################################
[   17s] libz1-1.2.11-16.1                     ########################################
[   17s] libgcc_s1-10.2.1+git958-1.1           ########################################
[   17s] libstdc++6-10.2.1+git958-1.1          ########################################
[   17s] libbz2-1-1.0.8-2.20                   ########################################
[   17s] libcrypt1-4.4.17-1.1                  ########################################
[   17s] update-alternatives-1.19.0.5-6.1      ########################################
[   17s] libgmp10-6.2.0-3.3                    ########################################
[   17s] perl-base-5.32.0-2.1                  ########################################
[   17s] terminfo-base-6.2.20201031-11.1       ########################################
[   17s] libncurses6-6.2.20201031-11.1         ########################################
[   17s] ncurses-utils-6.2.20201031-11.1       ########################################
[   17s] libelf1-0.181-1.1                     ########################################
[   17s] libacl1-2.2.53-4.1                    ########################################
[   17s] liblzma5-5.2.5-1.16                   ########################################
[   17s] libaudit1-2.8.5-2.3                   ########################################
[   17s] libcap2-2.43-1.1                      ########################################
[   17s] libreadline8-8.0-5.2                  ########################################
[   17s] bash-5.0.18-2.1                       ########################################
[   18s] gawk-5.1.0-1.23                       ########################################
[   18s] update-alternatives: using /usr/bin/gawk to provide /bin/awk (awk) in auto mode
[   18s] xz-5.2.5-1.16                         ########################################
[   18s] cpio-2.13-1.1                         ########################################
[   18s] libmpfr6-4.1.0-1.2                    ########################################
[   18s] fillup-1.42-275.3                     ########################################
[   18s] libattr1-2.4.48-3.19                  ########################################
[   18s] libblkid1-2.35.1-2.3                  ########################################
[   18s] libeconf0-0.3.8+git20200710.5126fff-2.########################################
[   18s] libffi8-3.3.git30-1.13                ########################################
[   18s] libgomp1-10.2.1+git958-1.1            ########################################
[   18s] libpopt0-1.18-2.1                     ########################################
[   18s] libuuid1-2.35.1-2.3                   ########################################
[   18s] libzstd1-1.4.5-2.4                    ########################################
[   18s] libp11-kit0-0.23.20-2.1               ########################################
[   18s] libmpc3-1.2.1-1.1                     ########################################
[   18s] diffutils-3.7-4.1                     ########################################
[   18s] which-2.21-4.31                       ########################################
[   18s] chkstat-1550_20201008-25.1            ########################################
[   18s] libxml2-2-2.9.10-6.1                  ########################################
[   18s] libdw1-0.181-1.1                      ########################################
[   18s] libisl22-0.22.1-1.16                  ########################################
[   18s] cpp10-10.2.1+git958-1.1               ########################################
[   18s] libexpat1-2.2.10-1.1                  ########################################
[   18s] libgdbm6-1.18.1-3.19                  ########################################
[   18s] libpcre1-8.44-1.19                    ########################################
[   18s] libselinux1-3.1-1.1                   ########################################
[   19s] coreutils-8.32-5.1                    ########################################
[   19s] sed-4.8-2.1                           ########################################
[   19s] grep-3.5-1.1                          ########################################
[   19s] findutils-4.7.0-5.1                   ########################################
[   19s] libtextstyle0-0.21-1.1                ########################################
[   19s] gettext-runtime-0.21-1.1              ########################################
[   19s] gettext-tools-0.21-1.1                ########################################
[   19s] systemd-rpm-macros-8-1.1              ########################################
[   19s] linux-glibc-devel-5.9-1.1             ########################################
[   19s] glibc-locale-base-2.32-3.1            ########################################
[   22s] glibc-locale-2.32-3.1                 ########################################
[   22s] permissions-config-1550_20201008-25.1 ########################################
[   22s] Updating /etc/sysconfig/security ...
[   22s] Checking permissions and ownerships - using the permissions files
[   22s] 	/usr/share/permissions/permissions
[   22s] 	/usr/share/permissions/permissions.easy
[   22s] 	/etc/permissions.local
[   22s] /sbin/unix2_chkpwd: setting to root:shadow 4755 (wrong owner/group root:root)
[   22s] /sbin/unix_chkpwd: setting to root:shadow 4755 (wrong owner/group root:root)
[   22s] /usr/bin/mount: setting to root:root 4755 (wrong permissions 0755)
[   22s] /usr/bin/su: setting to root:root 4755 (wrong permissions 0755)
[   22s] /usr/bin/umount: setting to root:root 4755 (wrong permissions 0755)
[   22s] permissions-20201008.1550-25.1        ########################################
[   22s] libmount1-2.35.1-2.3                  ########################################
[   22s] tar-1.32-3.5                          ########################################
[   22s] libgdbm_compat4-1.18.1-3.19           ########################################
[   22s] cpp-10-3.1                            ########################################
[   22s] libfdisk1-2.35.1-2.3                  ########################################
[   22s] gzip-1.10-4.1                         ########################################
[   22s] make-4.3-2.20                         ########################################
[   22s] bzip2-1.0.8-2.20                      ########################################
[   22s] libtasn1-4.16.0-1.6                   ########################################
[   22s] libtasn1-6-4.16.0-1.6                 ########################################
[   22s] p11-kit-0.23.20-2.1                   ########################################
[   22s] p11-kit-tools-0.23.20-2.1             ########################################
[   22s] libopenssl1_1-1.1.1h-1.1              ########################################
[   22s] openssl-1_1-1.1.1h-1.1                ########################################
[   22s] ca-certificates-2+git20201002.34daf7f-########################################
[   22s] ca-certificates-mozilla-2.44-1.1      ########################################
[   23s] dwz-0.13-7.2                          ########################################
[   23s] rpm-build-perl-4.15.1-8.1             ########################################
[   23s] libasan6-10.2.1+git958-1.1            ########################################
[   23s] libdb-4_8-4.8.30-38.23                ########################################
[   24s] perl-5.32.0-2.1                       ########################################
[   24s] liblsan0-10.2.1+git958-1.1            ########################################
[   24s] libtsan0-10.2.1+git958-1.1            ########################################
[   24s] libubsan1-10.2.1+git958-1.1           ########################################
[   24s] libctf-nobfd0-2.35.1-1.1              ########################################
[   25s] binutils-2.35.1-1.1                   ########################################
[   25s] update-alternatives: using /usr/bin/ld.bfd to provide /usr/bin/ld (ld) in auto mode
[   25s] libctf0-2.35.1-1.1                    ########################################
[   25s] libatomic1-10.2.1+git958-1.1          ########################################
[   25s] libcap-ng0-0.7.10-1.16                ########################################
[   25s] libcom_err2-1.45.6-1.19               ########################################
[   25s] libgpg-error0-1.39-1.1                ########################################
[   25s] libgcrypt20-1.8.7-1.1                 ########################################
[   25s] libhttp_parser2_9-2.9.4-1.2           ########################################
[   25s] libitm1-10.2.1+git958-1.1             ########################################
[   25s] libkeyutils1-1.6-1.19                 ########################################
[   25s] liblua5_3-5-5.3.6-1.1                 ########################################
[   25s] rpm-config-SUSE-0.g64-1.1             ########################################
[   25s] rpm-4.15.1-8.1                        ########################################
[   25s] Updating /etc/sysconfig/services ...
[   25s] libmnl0-1.0.4-2.3                     ########################################
[   25s] iproute2-5.9.0-2.1                    ########################################
[   25s] aaa_base-84.87+git20200918.331aa2f-1.1########################################
[   25s] Updating /etc/sysconfig/language ...
[   25s] Updating /etc/sysconfig/proxy ...
[   25s] Updating /etc/sysconfig/windowmanager ...
[   25s] aaa_base-malloccheck-84.87+git20200918########################################
[   25s] libpkgconf3-1.7.3-2.2                 ########################################
[   25s] pkgconf-1.7.3-2.2                     ########################################
[   25s] libsepol1-3.1-1.1                     ########################################
[   25s] libsemanage1-3.1-1.1                  ########################################
[   25s] libsmartcols1-2.35.1-2.3              ########################################
[   25s] libsqlite3-0-3.33.0-1.3               ########################################
[   25s] libuv1-1.39.0-1.1                     ########################################
[   25s] libverto1-0.3.1-1.1                   ########################################
[   25s] krb5-1.18.2-3.2                       ########################################
[   25s] libyaml-0-2-0.2.5-1.2                 ########################################
[   25s] patch-2.7.6-3.29                      ########################################
[   25s] python-rpm-macros-20200824.8fa42a7-1.1########################################
[   25s] pkgconf-m4-1.7.3-2.2                  ########################################
[   25s] pkgconf-pkg-config-1.7.3-2.2          ########################################
[   25s] libxcrypt-devel-4.4.17-1.1            ########################################
[   26s] glibc-devel-2.32-3.1                  ########################################
[   27s] gcc10-10.2.1+git958-1.1               ########################################
[   27s] gcc-10-3.1                            ########################################
[   27s] libtirpc-netconfig-1.2.6-1.16         ########################################
[   27s] libtirpc3-1.2.6-1.16                  ########################################
[   27s] libnsl2-1.3.0-1.3                     ########################################
[   27s] libpython3_8-1_0-3.8.6-1.2            ########################################
[   28s] python38-base-3.8.6-1.2               ########################################
[   28s] python38-3.8.6-1.1                    ########################################
[   28s] python3-six-1.15.0-102.1              ########################################
[   28s] python3-idna-2.10-18.8                ########################################
[   28s] python3-py-1.9.0-1.3                  ########################################
[   28s] python3-certifi-2020.11.8-55.1        ########################################
[   28s] shadow-4.8.1-5.1                      ########################################
[   28s] pam-1.5.0-1.1                         ########################################
[   28s] sysuser-shadow-3.0-5.1                ########################################
[   28s] /usr/sbin/groupadd -r kmem
[   28s] /usr/sbin/groupadd -r lock
[   28s] /usr/sbin/groupadd -r -g 5 tty
[   28s] /usr/sbin/groupadd -r utmp
[   28s] /usr/sbin/groupadd -r audio
[   28s] /usr/sbin/groupadd -r cdrom
[   28s] /usr/sbin/groupadd -r dialout
[   28s] /usr/sbin/groupadd -r disk
[   28s] /usr/sbin/groupadd -r input
[   28s] /usr/sbin/groupadd -r kvm
[   28s] /usr/sbin/groupadd -r lp
[   28s] /usr/sbin/groupadd -r render
[   28s] /usr/sbin/groupadd -r tape
[   28s] /usr/sbin/groupadd -r video
[   28s] system-group-hardware-20170617-13.1   ########################################
[   28s] libutempter0-1.2.0-3.1                ########################################
[   28s] util-linux-2.35.1-2.3                 ########################################
[   28s] /usr/bin/mount: setting to root:root 4755 (wrong permissions 0755)
[   28s] /usr/bin/umount: setting to root:root 4755 (wrong permissions 0755)
[   28s] /usr/bin/wall: setting to root:tty 2755 (wrong permissions 0755)
[   28s] /usr/bin/write: setting to root:tty 2755 (wrong permissions 0755)
[   28s] /usr/bin/su: setting to root:root 4755 (wrong permissions 0755)
[   28s] grep: /etc/default/su: No such file or directory
[   28s] python3-appdirs-1.4.4-27.1            ########################################
[   28s] python3-asn1crypto-1.4.0-20.1         ########################################
[   28s] python3-attrs-20.3.0-30.1             ########################################
[   28s] python3-h11-0.11.0-16.1               ########################################
[   28s] python3-iniconfig-1.1.1-5.1           ########################################
[   28s] python3-more-itertools-8.5.0-26.1     ########################################
[   28s] python3-ordered-set-3.1.1-18.1        ########################################
[   28s] python3-pluggy-0.13.1-1.4             ########################################
[   29s] python3-pyasn1-0.4.8-94.19            ########################################
[   29s] python3-pycparser-2.20-28.19          ########################################
[   29s] python3-cffi-1.14.3-82.3              ########################################
[   29s] python3-pyparsing-2.4.7-79.11         ########################################
[   29s] python3-packaging-20.4-44.3           ########################################
[   29s] python3-setuptools-44.1.1-192.1       ########################################
[   29s] python3-cryptography-3.2.1-137.1      ########################################
[   29s] python3-pyOpenSSL-19.1.0-67.5         ########################################
[   29s] python3-urllib3-1.26.2-119.1          ########################################
[   29s] python3-toml-0.10.2-17.2              ########################################
[   29s] python3-wcwidth-0.2.5-36.1            ########################################
[   29s] python3-pytest-6.1.2-2.1              ########################################
[   29s] rpm-build-python-4.15.1-8.1           ########################################
[   29s] python3-chardet-3.0.4-72.7            ########################################
[   29s] file-magic-5.39-1.3                   ########################################
[   29s] libmagic1-5.39-1.3                    ########################################
[   29s] file-5.39-1.3                         ########################################
[   29s] librpmbuild9-4.15.1-8.1               ########################################
[   29s] rpmlint-mini-1.10-22.18               ########################################
[   29s] rpmlint-Factory-1.0-98.2              ########################################
[   29s] rpm-build-4.15.1-8.1                  ########################################
[   29s] build-compare-20200727T175347.d95eb35-########################################
[   29s] python3-requests-2.25.0-121.1         ########################################
[   29s] python3-pytest-mock-3.1.1-1.2         ########################################
[   29s] python3-trustme-0.6.0-15.3            ########################################
[   29s] python3-click-7.1.2-34.1              ########################################
[   29s] python3-wsproto-1.0.0-20.1            ########################################
[   29s] python3-typing_extensions-3.7.4.3-25.1########################################
[   29s] python3-websockets-8.1-23.9           ########################################
[   29s] python3-PyYAML-5.3.1-52.90            ########################################
[   29s] python3-httptools-0.1.1-3.2           ########################################
[   29s] python3-uvloop-0.14.0-20.19           ########################################
[   29s] python3-watchgod-0.6-6.1              ########################################
[   29s] gcc-PIE-10-3.1                        ########################################
[   29s] post-build-checks-84.87+git20200916.d3########################################
[   29s] brp-check-suse-84.87+git20200910.75480########################################
[   30s] attr-2.4.48-3.19                      ########################################
[   30s] hostname-3.23-1.1                     ########################################
[   30s] build-mkbaselibs-20200828-1.1         ########################################
[   30s] fdupes-2.1.2-1.2                      ########################################
[   30s] kernel-obs-build-5.9.10-1.1           ########################################
@jayvdb
Copy link
Author

jayvdb commented Nov 29, 2020

One possible cause is the RPM builds are using a de-vendored httptools, which uses https://github.com/nodejs/http-parser v2.9.4, while the tests here are using https://github.com/MagicStack/httptools/tree/master/vendor v2.9.0 . This is extremely unlikely, because I packaged uvicorn two months ago, and all tests were passing then, and the http-parser package hasnt been modified since then.

Ah, I think I've found it. wsproto 1.0.0 has been released, and this is a related change.
python-hyper/wsproto@ff5aed4#diff-ed61569b603cffa356480d40575fc4df6b0f6197614018ab80eb946c92442188L227

@euri10
Copy link
Member

euri10 commented Dec 9, 2020

we pin wsproto at 0.15.* I think so that might explain why our test didnt see that.

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

Successfully merging a pull request may close this issue.

3 participants