Closed Bug 1745843 Opened 4 years ago Closed 3 years ago

websocketprocessbridge not launching properly on recent local builds

Categories

(Core :: WebRTC: Networking, task)

task

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: bwc, Assigned: bwc)

Details

Attachments

(1 file)

Seems that recent installations of python on linux and OS X are running into problems with the version of attrs (19.1.0) we have vendored in third_party/python. I've verified by hand that updating this vendored copy to 19.2.0 solves the problem locally, but of course this will effect lots of stuff besides our tests.

Ok, now I'm seeing different behavior. We have a more recent version of attrs in third_party, and if I add attrs to websocketprocessbridge_requirements_3.txt, it finds it:

Requirement already satisfied: attrs>=19.2.0 in ./third_party/python/attrs (from -r /Users/bcampen/checkouts/mozilla-central/testing/tools/websocketprocessbridge/websocketprocessbridge_requirements_3.txt (line 15)) (19.2.0)

But when it comes time to run, we fail to import:

Traceback (most recent call last):
  File "/Users/bcampen/checkouts/mozilla-central/obj-aarch64-apple-darwin22.3.0/_tests/testing/mochitest/websocketprocessbridge/websocketprocessbridge.py", line 8, in <module>
    from autobahn.twisted.websocket import WebSocketServerProtocol, WebSocketServerFactory
  File "/Users/bcampen/checkouts/mozilla-central/obj-aarch64-apple-darwin22.3.0/_virtualenvs/common/lib/python3.9/site-packages/autobahn/twisted/__init__.py", line 40, in <module>
    from autobahn.twisted.websocket import \
  File "/Users/bcampen/checkouts/mozilla-central/obj-aarch64-apple-darwin22.3.0/_virtualenvs/common/lib/python3.9/site-packages/autobahn/twisted/websocket.py", line 35, in <module>
    from twisted.internet import endpoints
  File "/Users/bcampen/checkouts/mozilla-central/obj-aarch64-apple-darwin22.3.0/_virtualenvs/common/lib/python3.9/site-packages/twisted/internet/endpoints.py", line 63, in <module>
    from twisted.python.systemd import ListenFDs
  File "/Users/bcampen/checkouts/mozilla-central/obj-aarch64-apple-darwin22.3.0/_virtualenvs/common/lib/python3.9/site-packages/twisted/python/systemd.py", line 18, in <module>
    from attrs import Factory, define
ModuleNotFoundError: No module named 'attrs'
 0:03.17 ERROR runtests.py | websocket/process bridge failed to launch. Are all the dependencies installed?

Additionally, I do not see anything in-tree that tries to import anything from attrs (besides tests within attrs itself), which makes me wonder why we vendor it in the first place...

I think the answer to both questions is that while the package is called attrs, the module is actually attr:
https://searchfox.org/mozilla-central/search?q=import+attr&path=.py%24&case=true&regexp=false

Looks like attrs changed their API a couple years back and switched from import attr to import attrs:
https://www.attrs.org/en/stable/changelog.html#id7

So I guess that version of twisted will require at least version 21.3.0. Maybe they don't have their dependency constrained correctly? If it's too hard to update attrs in the vendored dir, adding it directly to websocketprocessbridge_requirements.txt might work. Either that or downgrade twisted to a version that is compatible with our vendored attrs.

So adding a more recent version of attrs to the requirements file helps a little, but still breaks because the new attrs in the virtualenv eventually tries to import stuff from our vendored attrs.

Traceback (most recent call last):
  File "/Users/bcampen/checkouts/mozilla-central/obj-aarch64-apple-darwin22.3.0/_tests/testing/mochitest/websocketprocessbridge/websocketprocessbridge.py", line 8, in <module>
    from autobahn.twisted.websocket import WebSocketServerProtocol, WebSocketServerFactory
  File "/Users/bcampen/checkouts/mozilla-central/obj-aarch64-apple-darwin22.3.0/_virtualenvs/common/lib/python3.9/site-packages/autobahn/twisted/__init__.py", line 40, in <module>
    from autobahn.twisted.websocket import \
  File "/Users/bcampen/checkouts/mozilla-central/obj-aarch64-apple-darwin22.3.0/_virtualenvs/common/lib/python3.9/site-packages/autobahn/twisted/websocket.py", line 35, in <module>
    from twisted.internet import endpoints
  File "/Users/bcampen/checkouts/mozilla-central/obj-aarch64-apple-darwin22.3.0/_virtualenvs/common/lib/python3.9/site-packages/twisted/internet/endpoints.py", line 63, in <module>
    from twisted.python.systemd import ListenFDs
  File "/Users/bcampen/checkouts/mozilla-central/obj-aarch64-apple-darwin22.3.0/_virtualenvs/common/lib/python3.9/site-packages/twisted/python/systemd.py", line 18, in <module>
    from attrs import Factory, define
  File "/Users/bcampen/checkouts/mozilla-central/obj-aarch64-apple-darwin22.3.0/_virtualenvs/common/lib/python3.9/site-packages/attrs/__init__.py", line 3, in <module>
    from attr import (
ImportError: cannot import name 'AttrsInstance' from 'attr' (/Users/bcampen/checkouts/mozilla-central/third_party/python/attrs/attr/__init__.py)

I figured out the workaround. This needs to restrict twisted to exactly version 18.7.0:

https://searchfox.org/mozilla-central/rev/08362489086b10de96e7a199b267ea5504c01583/testing/tools/websocketprocessbridge/websocketprocessbridge_requirements_3.txt#5

On local builds, we were getting newer versions than our vendored attrs could deal with, and twisted's dependencies must have been wrong to boot.

Assignee: nobody → docfaraday

Huh. We don't have that version in our pypi. Trying another...

It seems that we do not have a copy of twisted 20.3.0 on our pypi that works with windows?

https://treeherder.mozilla.org/jobs?repo=try&revision=ba4f13cb1fabac1c3090b054ecb0ac8e2c8a8a5c

Flags: needinfo?(ahal)

21.2.0 works!

Try looks fine.

Pushed by bcampen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d834a5a53b08 Restrict the version of twisted to something that can work with our vendored attrs. r=ahal
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
Flags: needinfo?(ahal)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: