Closed Bug 1660197 Opened 5 years ago Closed 5 years ago

All websocket mochitests fails when running locally after python env update

Categories

(Testing :: Mochitest, defect)

defect

Tracking

(firefox-esr68 unaffected, firefox-esr78 unaffected, firefox79 unaffected, firefox80 unaffected, firefox81 affected)

RESOLVED DUPLICATE of bug 1660128
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- unaffected
firefox79 --- unaffected
firefox80 --- unaffected
firefox81 --- affected

People

(Reporter: jdescottes, Unassigned)

References

(Regression)

Details

(Keywords: regression)

After the python env changes from Bug 1656993 the test https://searchfox.org/mozilla-central/source/devtools/shared/resources/tests/browser_resources_websocket.js fails locally.

It times out after outputting could not open connection to the real server. It relies on a python helper file: https://searchfox.org/mozilla-central/source/devtools/shared/resources/tests/websocket_backend_wsh.py

from __future__ import absolute_import
from mod_pywebsocket import msgutil


def web_socket_do_extra_handshake(request):
    pass


def web_socket_transfer_data(request):
    while not request.client_terminated:
        resp = msgutil.receive_message(request)
        msgutil.send_message(request, resp)


def web_socket_passive_closing_handshake(request):
    # If we use `pass` here, the `payload` of `frameReceived` which will be happened
    # of communication of closing will be `\u0003è`. In order to make the `payload`
    # to be empty string, return code and reason explicitly.
    code = None
    reason = None
    return code, reason

Joel: all the tests using pywebsocket seem to fail locally but not on try.
Any idea why the recent python env changes have regressed this?

Component: General → Mochitest
Flags: needinfo?(jmaher)
Product: Firefox Build System → Testing
Summary: browser_resources_websocket.js fails when running locally → websocket tests fails when running locally after python env update

I can reproduce this, but I cannot find where we call websocket_backend_wsh.py anywhere. Can you point me to this?

Flags: needinfo?(jmaher)

Set release status flags based on info from the regressing bug 1656993

From what I can piece together mod_pywebsocket will append _wsh.py here: https://searchfox.org/mozilla-central/rev/6cc48251bb97600fdf11a5b4c5f621bfc8606d55/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/dispatch.py#110-119

def _enumerate_handler_file_paths(directory):
    """Returns a generator that enumerates WebSocket Handler source file names
    in the given directory.
    """

    for root, unused_dirs, files in os.walk(directory):
        for base in files:
            path = os.path.join(root, base)
            if _SOURCE_PATH_PATTERN.search(path):
                yield path

with

_SOURCE_PATH_PATTERN = re.compile(r'(?i)_wsh\.py$')
_SOURCE_SUFFIX = '_wsh.py'

Then individual tests just create websockets via:

        webSocket = new WebSocket(
          "ws://mochi.test:8888/browser/devtools/shared/resources/tests/websocket_backend"
        );

and websocket_backend becomes websocket_backend_wsh.py. Although I don't know much about the way mod_pywebsocket works

Or I guess it's the opposite, it identifies websocket handlers by looking for files ending with "_wsh.py" and then tests just have to access them via the path without "_wsh.py"

Is it related to the fact that we install these dependencies on the fly here?
https://searchfox.org/mozilla-central/source/testing/mochitest/mach_commands.py#372

Though this test doesn't seem like it's in the mochitest-media suite, so maybe not. Unless it was only previously working for you by accident (i.e you happened to run a mochitest-media test prior to the devtools one)?

Though this test doesn't seem like it's in the mochitest-media suite, so maybe not. Unless it was only previously working for you by accident (i.e you happened to run a mochitest-media test prior to the devtools one)?

The test was running fine in isolation before.

Also, even though we spotted the issue on this specific devtools test, it impacts all the tests using mod_pywebsocket, including the ones in dom/websocket: https://searchfox.org/mozilla-central/source/dom/websocket/

Summary: websocket tests fails when running locally after python env update → All websocket mochitests fails when running locally after python env update

I haven't looked closely yet, but is this a dupe of bug 1660128 (with the same fix as suggested by me in the comment)?

This test works fine for me (doesn't time out, concludes elegantly with a 0 exit code) after the patch in bug 1660128, so I'm inclined to say this is a dupe.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.