Skip to content

websocket tests sometimes don't run #20734

Closed

Description

@jdm

This appeared in the log:

STDERR: No handlers could be found for logger "mod_pywebsocket.standalone.WebSocketServer"
STDERR: No handlers could be found for logger "mod_pywebsocket.standalone.WebSocketServer"
STDERR: No handlers could be found for logger "mod_pywebsocket.standalone.WebSocketServer"

Activity

  1. jdm commented on May 2, 2018

    @jdm
    MemberAuthor

    Followed by a lot of:

      ▶ TIMEOUT [expected OK] /websockets/interfaces/WebSocket/send/008.html
      │ 
      │ VMware, Inc.
      │ softpipe
      └ 3.3 (Core Profile) Mesa 17.3.0-devel
    
      ▶ Unexpected subtest result in /websockets/interfaces/WebSocket/send/008.html:
      │ TIMEOUT [expected PASS] WebSockets: send() in onclose
      └   → Test timed out
    
  2. jdm commented on May 2, 2018

    @jdm
    MemberAuthor

    I have pushed web-platform-tests/wpt#10804 to attempt to address those logging issues and hopefully shed some light on this.

  3. jdm commented on May 19, 2018

    @jdm
    MemberAuthor

    This has been observed on both linux and mac.

  4. added
    I-intermittent
    on May 19, 2018
  5. jdm commented on May 22, 2018

    @jdm
    MemberAuthor

    From #testing:

    11:05 <jdm> jgraham: cant we chat about the websocket logging issue/
    11:05 <jdm> jgraham: we have really bad problems on our CI with large swaths of websocket tests intermittently timing out, presumably because the server is not set up correctly
    11:06 <jdm> and suspicious messages about how there's no default logger configured for the websocket server
    11:07 <jgraham> jdm: So there are a couple of problems with logging
    11:08 <jgraham> The first is that we use multiprocessing and the default logger is not multiprocessing safe (it uses a threading.Lock which can be locked in the child process due to hillarious design problems in multiprocessing)
    11:09 <jgraham> The second problem is that mozlog really wants to own all the logging, so it can produce a nice stream of json objects rather than a mixture of json objects and random other strings
    11:09 <jgraham> So there is a wrapper for stdlib logging, but I think it's somewhat broken, and in any case doesn't solve the multiprocessing issue
    11:10 <jgraham> What we really want to do is to pass over a logger that puts log messages into a queue and re-logs them on the main thread
    11:10 <jgraham> s/thread/process/
    11:11 <jdm> that sounds doable
    11:11 <jgraham> jdm: Yeah, so there is something similar in tools/wptrunner/wptrunner/wptlogging.py
    11:12 <jgraham> Which wraps stdio
    
  6. jdm commented on May 22, 2018

    @jdm
    MemberAuthor
    diff --git a/testing/web-platform/tests/tools/serve/serve.py b/testing/web-platform/tests/tools/serve/serve.py
    index 0fd5f907e964..028d1f406fd5 100644
    --- a/testing/web-platform/tests/tools/serve/serve.py
    +++ b/testing/web-platform/tests/tools/serve/serve.py
    @@ -22,6 +22,7 @@ from localpaths import repo_root
     from six.moves import reload_module
     
     from manifest.sourcefile import read_script_metadata, js_meta_re, parse_variants
    +from wptrunner import wptlogging
     from wptserve import server as wptserve, handlers
     from wptserve import stash
     from wptserve import config
    @@ -356,19 +357,19 @@ class ServerProc(object):
             self.stop = Event()
     
         def start(self, init_func, host, port, paths, routes, bind_address, config,
    -              ssl_config, **kwargs):
    +              ssl_config, logging_queue, **kwargs):
             self.proc = Process(target=self.create_daemon,
                                 args=(init_func, host, port, paths, routes, bind_address,
    -                                  config, ssl_config),
    +                                  config, ssl_config, logging_queue),
                                 kwargs=kwargs)
             self.proc.daemon = True
             self.proc.start()
     
         def create_daemon(self, init_func, host, port, paths, routes, bind_address,
    -                      config, ssl_config, **kwargs):
    +                      config, ssl_config, logging_queue, **kwargs):
             try:
                 self.daemon = init_func(host, port, paths, routes, bind_address, config,
    -                                    ssl_config, **kwargs)
    +                                    ssl_config, logging_queue, **kwargs)
             except socket.error:
                 print("Socket error on port %s" % port, file=sys.stderr)
                 raise
    @@ -400,7 +401,7 @@ class ServerProc(object):
             return self.proc.is_alive()
     
     
    -def check_subdomains(config):
    +def check_subdomains(config, logging_queue):
         paths = config.paths
         bind_address = config.bind_address
         ssl_config = config.ssl_config
    @@ -412,7 +413,7 @@ def check_subdomains(config):
     
         wrapper = ServerProc()
         wrapper.start(start_http_server, host, port, paths, build_routes(aliases), bind_address,
    -                  None, ssl_config)
    +                  None, ssl_config, logging_queue)
     
         connected = False
         for i in range(10):
    @@ -463,7 +464,7 @@ def make_hosts_file(config, host):
     
     
     def start_servers(host, ports, paths, routes, bind_address, config, ssl_config,
    -                  **kwargs):
    +                  logging_queue, **kwargs):
         servers = defaultdict(list)
         for scheme, ports in ports.iteritems():
             assert len(ports) == {"http":2}.get(scheme, 1)
    @@ -478,14 +479,19 @@ def start_servers(host, ports, paths, routes, bind_address, config, ssl_config,
     
                 server_proc = ServerProc()
                 server_proc.start(init_func, host, port, paths, routes, bind_address,
    -                              config, ssl_config, **kwargs)
    +                              config, ssl_config, logging_queue, **kwargs)
                 servers[scheme].append((port, server_proc))
     
         return servers
     
     
    -def start_http_server(host, port, paths, routes, bind_address, config, ssl_config,
    +def start_http_server(host, port, paths, routes, bind_address, config, ssl_config, logging_queue,
                           **kwargs):
    +    if logging_queue:
    +        root_logger = logging.getLogger()
    +        root_logger.setLevel(logging.INFO)
    +        root_logger.addHandler(wptlogging.StdQueueHandler(logging_queue, component="wptserve:http"))
    +
         return wptserve.WebTestHttpd(host=host,
                                      port=port,
                                      doc_root=paths["doc_root"],
    @@ -499,8 +505,13 @@ def start_http_server(host, port, paths, routes, bind_address, config, ssl_confi
                                      latency=kwargs.get("latency"))
     
     
    -def start_https_server(host, port, paths, routes, bind_address, config, ssl_config,
    +def start_https_server(host, port, paths, routes, bind_address, config, ssl_config, logging_queue,
                            **kwargs):
    +    if logging_queue:
    +        root_logger = logging.getLogger()
    +        root_logger.setLevel(logging.INFO)
    +        root_logger.addHandler(wptlogging.StdQueueHandler(logging_queue, component="wptserve:https"))
    +
         return wptserve.WebTestHttpd(host=host,
                                      port=port,
                                      doc_root=paths["doc_root"],
    @@ -517,7 +528,7 @@ def start_https_server(host, port, paths, routes, bind_address, config, ssl_conf
     
     class WebSocketDaemon(object):
         def __init__(self, host, port, doc_root, handlers_root, log_level, bind_address,
    -                 ssl_config):
    +                 ssl_config, logging_queue):
             self.host = host
             cmd_args = ["-p", port,
                         "-d", doc_root,
    @@ -546,6 +557,14 @@ class WebSocketDaemon(object):
             opts, args = pywebsocket._parse_args_and_config(cmd_args)
             opts.cgi_directories = []
             opts.is_executable_method = None
    +
    +        if logging_queue:
    +            root_logger = logging.getLogger()
    +            root_logger.addHandler(wptlogging.StdQueueHandler(
    +                logging_queue,
    +                component="pywebsocket:%s" % ("wss" if ssl_config else "ws")))
    +            root_logger.setLevel(logging.getLevelName(opts.log_level.upper()))
    +
             self.server = pywebsocket.WebSocketServer(opts)
             ports = [item[0].getsockname()[1] for item in self.server._sockets]
             assert all(item == ports[0] for item in ports)
    @@ -580,35 +599,39 @@ class WebSocketDaemon(object):
             self.server = None
     
     
    -def start_ws_server(host, port, paths, routes, bind_address, config, ssl_config,
    +def start_ws_server(host, port, paths, routes, bind_address, config, ssl_config, logging_queue,
                         **kwargs):
         # Ensure that when we start this in a new process we don't inherit the
         # global lock in the logging module
         reload_module(logging)
    +    reload_module(wptlogging)
         return WebSocketDaemon(host,
                                str(port),
                                repo_root,
                                paths["ws_doc_root"],
                                "debug",
                                bind_address,
    -                           ssl_config = None)
    +                           ssl_config = None,
    +                           logging_queue=logging_queue)
     
     
    -def start_wss_server(host, port, paths, routes, bind_address, config, ssl_config,
    +def start_wss_server(host, port, paths, routes, bind_address, config, ssl_config, logging_queue,
                          **kwargs):
         # Ensure that when we start this in a new process we don't inherit the
         # global lock in the logging module
         reload_module(logging)
    +    reload_module(wptlogging)
         return WebSocketDaemon(host,
                                str(port),
                                repo_root,
                                paths["ws_doc_root"],
                                "debug",
                                bind_address,
    -                           ssl_config)
    +                           ssl_config,
    +                           logging_queue=logging_queue)
     
     
    -def start(config, ssl_environment, routes, **kwargs):
    +def start(config, ssl_environment, routes, logging_queue, **kwargs):
         host = config["server_host"]
         ports = config.ports
         paths = config.paths
    @@ -618,7 +641,7 @@ def start(config, ssl_environment, routes, **kwargs):
         logger.debug("Using ports: %r" % ports)
     
         servers = start_servers(host, ports, paths, routes, bind_address, config,
    -                            ssl_config, **kwargs)
    +                            ssl_config, logging_queue, **kwargs)
     
         return servers
     
    @@ -757,8 +780,9 @@ def run(**kwargs):
     
         bind_address = config["bind_address"]
     
    +
         if config["check_subdomains"]:
    -        check_subdomains(config)
    +        check_subdomains(config, logging_queue=None)
     
         stash_address = None
         if bind_address:
    @@ -766,7 +790,8 @@ def run(**kwargs):
             logger.debug("Going to use port %d for stash" % stash_address[1])
     
         with stash.StashServer(stash_address, authkey=str(uuid.uuid4())):
    -        servers = start(config, config.ssl_env, build_routes(config["aliases"]), **kwargs)
    +        servers = start(config, config.ssl_env, build_routes(config["aliases"]), logging_queue=None,
    +                        **kwargs)
     
             try:
                 while any(item.is_alive() for item in iter_procs(servers)):
    diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/environment.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/environment.py
    index 309174c42e65..d23eab40a11b 100644
    --- a/testing/web-platform/tests/tools/wptrunner/wptrunner/environment.py
    +++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/environment.py
    @@ -64,9 +64,10 @@ class TestEnvironmentError(Exception):
     
     
     class TestEnvironment(object):
    -    def __init__(self, test_paths, ssl_env, pause_after_test, debug_info, options, env_extras):
    +    def __init__(self, logging_queue, test_paths, ssl_env, pause_after_test, debug_info, options, env_extras):
             """Context manager that owns the test environment i.e. the http and
             websockets servers"""
    +        self.logging_queue = logging_queue
             self.test_paths = test_paths
             self.ssl_env = ssl_env
             self.server = None
    @@ -102,7 +103,8 @@ class TestEnvironment(object):
     
             self.servers = serve.start(self.config,
                                        self.ssl_env,
    -                                   self.get_routes())
    +                                   self.get_routes(),
    +                                   self.logging_queue)
             if self.options.get("supports_debugger") and self.debug_info and self.debug_info.interactive:
                 self.ignore_interrupts()
             return self
    diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/wptlogging.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/wptlogging.py
    index 26d174c066bc..4c15f42428a0 100644
    --- a/testing/web-platform/tests/tools/wptrunner/wptrunner/wptlogging.py
    +++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/wptlogging.py
    @@ -1,12 +1,12 @@
     import logging
     import sys
     import threading
    -from Queue import Empty
     from StringIO import StringIO
     from multiprocessing import Queue
     
    -from mozlog import commandline, stdadapter, set_default_logger
    -from mozlog.structuredlog import StructuredLogger
    +from mozlog import commandline, get_default_logger, stdadapter, set_default_logger
    +from mozlog.structuredlog import StructuredLogger, log_levels
    +
     
     def setup(args, defaults):
         logger = args.pop('log', None)
    @@ -53,32 +53,41 @@ class LogLevelRewriter(object):
     
     
     class LogThread(threading.Thread):
    -    def __init__(self, queue, logger, level):
    +    def __init__(self, queue, logger):
    +        assert logger.component is None
             self.queue = queue
    -        self.log_func = getattr(logger, level)
    +        self.loggers = {None: logger}
             threading.Thread.__init__(self, name="Thread-Log")
             self.daemon = True
     
    +    def get_logger(self, component=None):
    +        if component not in self.loggers:
    +            name = self.loggers[None].name
    +            self.loggers[component] = StructuredLogger(name, component)
    +        return self.loggers[component]
    +
         def run(self):
             while True:
                 try:
    -                msg = self.queue.get()
    +                command = self.queue.get()
                 except (EOFError, IOError):
                     break
    -            if msg is None:
    +            if command is None:
                     break
                 else:
    -                self.log_func(msg)
    +                component, level, msg = command
    +                getattr(self.get_logger(component), level)(msg)
     
     
    -class LoggingWrapper(StringIO):
    +class FileLogging(StringIO):
         """Wrapper for file like objects to redirect output to logger
         instead"""
     
    -    def __init__(self, queue, prefix=None):
    +    def __init__(self, queue, prefix=None, level="info"):
             StringIO.__init__(self)
             self.queue = queue
             self.prefix = prefix
    +        self.level = level
     
         def write(self, data):
             if isinstance(data, str):
    @@ -95,41 +104,69 @@ class LoggingWrapper(StringIO):
                 return
             if self.prefix is not None:
                 data = "%s: %s" % (self.prefix, data)
    -        self.queue.put(data)
    +        self.queue.put((None, self.level, data))
     
         def flush(self):
             pass
     
     
     class CaptureIO(object):
    -    def __init__(self, logger, do_capture):
    -        self.logger = logger
    +    def __init__(self, queue, do_capture):
    +        self.logging_queue = queue
             self.do_capture = do_capture
    -        self.logging_queue = None
    -        self.logging_thread = None
             self.original_stdio = None
     
         def __enter__(self):
             if self.do_capture:
                 self.original_stdio = (sys.stdout, sys.stderr)
    -            self.logging_queue = Queue()
    -            self.logging_thread = LogThread(self.logging_queue, self.logger, "info")
    -            sys.stdout = LoggingWrapper(self.logging_queue, prefix="STDOUT")
    -            sys.stderr = LoggingWrapper(self.logging_queue, prefix="STDERR")
    -            self.logging_thread.start()
    +            sys.stdout = FileLogging(self.logging_queue, prefix="STDOUT")
    +            sys.stderr = FileLogging(self.logging_queue, prefix="STDERR")
     
         def __exit__(self, *args, **kwargs):
             if self.do_capture:
                 sys.stdout, sys.stderr = self.original_stdio
    -            if self.logging_queue is not None:
    -                self.logger.info("Closing logging queue")
    -                self.logging_queue.put(None)
    -                if self.logging_thread is not None:
    -                    self.logging_thread.join(10)
    -                while not self.logging_queue.empty():
    -                    try:
    -                        self.logger.warning("Dropping log message: %r", self.logging_queue.get())
    -                    except Exception:
    -                        pass
    -                self.logging_queue.close()
    -                self.logger.info("queue closed")
    +
    +
    +class StdQueueHandler(logging.Handler):
    +    def __init__(self, queue, component=None, level=logging.NOTSET):
    +        super(StdQueueHandler, self).__init__(level=level)
    +        self.component = component
    +        self.queue = queue
    +
    +    def emit(self, record):
    +        if record.levelname in log_levels:
    +            level = record.levelname.lower()
    +        else:
    +            level = "debug"
    +        msg = record.msg
    +        if record.args:
    +            msg = msg % record.args
    +        self.queue.put((self.component, level, msg))
    +
    +    def handle(self, record):
    +        self.emit(record)
    +
    +
    +class LoggingQueue(object):
    +    def __init__(self, logger):
    +        self.logger = logger
    +        self.queue = Queue()
    +        self.thread = None
    +
    +    def __enter__(self):
    +        self.thread = LogThread(self.queue, self.logger)
    +        self.thread.start()
    +        return self.queue
    +
    +    def __exit__(self, *args, **kwargs):
    +        self.logger.info("Closing logging queue")
    +        self.queue.put(None)
    +        if self.thread is not None:
    +            self.thread.join(10)
    +        while not self.queue.empty():
    +            try:
    +                self.logger.warning("Dropping log message: %r", self.queue.get())
    +            except Exception:
    +                pass
    +        self.queue.close()
    +        self.logger.info("queue closed")
    diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
    index bd2b3ad23bd0..0b31668f7f44 100644
    --- a/testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
    +++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
    @@ -135,159 +135,161 @@ def get_pause_after_test(test_loader, **kwargs):
     
     
     def run_tests(config, test_paths, product, **kwargs):
    -    with wptlogging.CaptureIO(logger, not kwargs["no_capture_stdio"]):
    -        env.do_delayed_imports(logger, test_paths)
    -
    -        (check_args,
    -         target_browser_cls, get_browser_kwargs,
    -         executor_classes, get_executor_kwargs,
    -         env_options, get_env_extras, run_info_extras) = products.load_product(config, product)
    -
    -        ssl_env = env.ssl_env(logger, **kwargs)
    -        env_extras = get_env_extras(**kwargs)
    -
    -        check_args(**kwargs)
    -
    -        if kwargs["install_fonts"]:
    -            env_extras.append(FontInstaller(
    -                font_dir=kwargs["font_dir"],
    -                ahem=os.path.join(kwargs["tests_root"], "fonts/Ahem.ttf")
    -            ))
    -
    -        if "test_loader" in kwargs:
    -            run_info = wpttest.get_run_info(kwargs["run_info"], product,
    -                                            browser_version=kwargs.get("browser_version"),
    -                                            debug=None,
    -                                            extras=run_info_extras(**kwargs))
    -            test_loader = kwargs["test_loader"]
    -        else:
    -            run_info, test_loader = get_loader(test_paths,
    -                                               product,
    -                                               ssl_env,
    -                                               run_info_extras=run_info_extras(**kwargs),
    -                                               **kwargs)
    -
    -        test_source_kwargs = {"processes": kwargs["processes"]}
    -        if kwargs["run_by_dir"] is False:
    -            test_source_cls = testloader.SingleTestSource
    -        else:
    -            # A value of None indicates infinite depth
    -            test_source_cls = testloader.PathGroupedSource
    -            test_source_kwargs["depth"] = kwargs["run_by_dir"]
    -
    -        logger.info("Using %i client processes" % kwargs["processes"])
    -
    -        test_total = 0
    -        unexpected_total = 0
    -
    -        kwargs["pause_after_test"] = get_pause_after_test(test_loader, **kwargs)
    -
    -        with env.TestEnvironment(test_paths,
    -                                 ssl_env,
    -                                 kwargs["pause_after_test"],
    -                                 kwargs["debug_info"],
    -                                 env_options,
    -                                 env_extras) as test_environment:
    -            try:
    -                test_environment.ensure_started()
    -            except env.TestEnvironmentError as e:
    -                logger.critical("Error starting test environment: %s" % e.message)
    -                raise
    -
    -            repeat = kwargs["repeat"]
    -            repeat_count = 0
    -            repeat_until_unexpected = kwargs["repeat_until_unexpected"]
    -
    -            while repeat_count < repeat or repeat_until_unexpected:
    -                repeat_count += 1
    -                if repeat_until_unexpected:
    -                    logger.info("Repetition %i" % (repeat_count))
    -                elif repeat > 1:
    -                    logger.info("Repetition %i / %i" % (repeat_count, repeat))
    -
    -                test_count = 0
    -                unexpected_count = 0
    -                logger.suite_start(test_loader.test_ids, name='web-platform-test', run_info=run_info)
    -                for test_type in kwargs["test_types"]:
    -                    logger.info("Running %s tests" % test_type)
    -
    -                    # WebDriver tests may create and destroy multiple browser
    -                    # processes as part of their expected behavior. These
    -                    # processes are managed by a WebDriver server binary. This
    -                    # obviates the need for wptrunner to provide a browser, so
    -                    # the NullBrowser is used in place of the "target" browser
    -                    if test_type == "wdspec":
    -                        browser_cls = NullBrowser
    -                    else:
    -                        browser_cls = target_browser_cls
    -
    -                    browser_kwargs = get_browser_kwargs(test_type,
    -                                                        run_info,
    -                                                        ssl_env=ssl_env,
    -                                                        config=test_environment.config,
    -                                                        **kwargs)
    -
    -                    executor_cls = executor_classes.get(test_type)
    -                    executor_kwargs = get_executor_kwargs(test_type,
    -                                                          test_environment.config,
    -                                                          test_environment.cache_manager,
    -                                                          run_info,
    -                                                          **kwargs)
    -
    -                    if executor_cls is None:
    -                        logger.error("Unsupported test type %s for product %s" %
    -                                     (test_type, product))
    -                        continue
    -
    -                    for test in test_loader.disabled_tests[test_type]:
    -                        logger.test_start(test.id)
    -                        logger.test_end(test.id, status="SKIP")
    -
    -                    if test_type == "testharness":
    -                        run_tests = {"testharness": []}
    -                        for test in test_loader.tests["testharness"]:
    -                            if test.testdriver and not executor_cls.supports_testdriver:
    -                                logger.test_start(test.id)
    -                                logger.test_end(test.id, status="SKIP")
    -                            elif test.jsshell and not executor_cls.supports_jsshell:
    -                                # We expect that tests for JavaScript shells
    -                                # will not be run along with tests that run in
    -                                # a full web browser, so we silently skip them
    -                                # here.
    -                                pass
    -                            else:
    -                                run_tests["testharness"].append(test)
    -                    else:
    -                        run_tests = test_loader.tests
    -
    -                    with ManagerGroup("web-platform-tests",
    -                                      kwargs["processes"],
    -                                      test_source_cls,
    -                                      test_source_kwargs,
    -                                      browser_cls,
    -                                      browser_kwargs,
    -                                      executor_cls,
    -                                      executor_kwargs,
    -                                      kwargs["rerun"],
    -                                      kwargs["pause_after_test"],
    -                                      kwargs["pause_on_unexpected"],
    -                                      kwargs["restart_on_unexpected"],
    -                                      kwargs["debug_info"]) as manager_group:
    -                        try:
    -                            manager_group.run(test_type, run_tests)
    -                        except KeyboardInterrupt:
    -                            logger.critical("Main thread got signal")
    -                            manager_group.stop()
    -                            raise
    -                    test_count += manager_group.test_count()
    -                    unexpected_count += manager_group.unexpected_count()
    -
    -                test_total += test_count
    -                unexpected_total += unexpected_count
    -                logger.info("Got %i unexpected results" % unexpected_count)
    -                if repeat_until_unexpected and unexpected_total > 0:
    -                    break
    -                logger.suite_end()
    +    with wptlogging.LoggingQueue(logger) as logging_queue:
    +        with wptlogging.CaptureIO(logging_queue, not kwargs["no_capture_stdio"]):
    +            env.do_delayed_imports(logger, test_paths)
    +
    +            (check_args,
    +             target_browser_cls, get_browser_kwargs,
    +             executor_classes, get_executor_kwargs,
    +             env_options, get_env_extras, run_info_extras) = products.load_product(config, product)
    +
    +            ssl_env = env.ssl_env(logger, **kwargs)
    +            env_extras = get_env_extras(**kwargs)
    +
    +            check_args(**kwargs)
    +
    +            if kwargs["install_fonts"]:
    +                env_extras.append(FontInstaller(
    +                    font_dir=kwargs["font_dir"],
    +                    ahem=os.path.join(kwargs["tests_root"], "fonts/Ahem.ttf")
    +                ))
    +
    +            if "test_loader" in kwargs:
    +                run_info = wpttest.get_run_info(kwargs["run_info"], product,
    +                                                browser_version=kwargs.get("browser_version"),
    +                                                debug=None,
    +                                                extras=run_info_extras(**kwargs))
    +                test_loader = kwargs["test_loader"]
    +            else:
    +                run_info, test_loader = get_loader(test_paths,
    +                                                   product,
    +                                                   ssl_env,
    +                                                   run_info_extras=run_info_extras(**kwargs),
    +                                                   **kwargs)
    +
    +            test_source_kwargs = {"processes": kwargs["processes"]}
    +            if kwargs["run_by_dir"] is False:
    +                test_source_cls = testloader.SingleTestSource
    +            else:
    +                # A value of None indicates infinite depth
    +                test_source_cls = testloader.PathGroupedSource
    +                test_source_kwargs["depth"] = kwargs["run_by_dir"]
    +
    +            logger.info("Using %i client processes" % kwargs["processes"])
    +
    +            test_total = 0
    +            unexpected_total = 0
    +
    +            kwargs["pause_after_test"] = get_pause_after_test(test_loader, **kwargs)
    +
    +            with env.TestEnvironment(logging_queue,
    +                                     test_paths,
    +                                     ssl_env,
    +                                     kwargs["pause_after_test"],
    +                                     kwargs["debug_info"],
    +                                     env_options,
    +                                     env_extras) as test_environment:
    +                try:
    +                    test_environment.ensure_started()
    +                except env.TestEnvironmentError as e:
    +                    logger.critical("Error starting test environment: %s" % e.message)
    +                    raise
    +
    +                repeat = kwargs["repeat"]
    +                repeat_count = 0
    +                repeat_until_unexpected = kwargs["repeat_until_unexpected"]
    +
    +                while repeat_count < repeat or repeat_until_unexpected:
    +                    repeat_count += 1
    +                    if repeat_until_unexpected:
    +                        logger.info("Repetition %i" % (repeat_count))
    +                    elif repeat > 1:
    +                        logger.info("Repetition %i / %i" % (repeat_count, repeat))
    +
    +                    test_count = 0
    +                    unexpected_count = 0
    +                    logger.suite_start(test_loader.test_ids, name='web-platform-test', run_info=run_info)
    +                    for test_type in kwargs["test_types"]:
    +                        logger.info("Running %s tests" % test_type)
    +
    +                        # WebDriver tests may create and destroy multiple browser
    +                        # processes as part of their expected behavior. These
    +                        # processes are managed by a WebDriver server binary. This
    +                        # obviates the need for wptrunner to provide a browser, so
    +                        # the NullBrowser is used in place of the "target" browser
    +                        if test_type == "wdspec":
    +                            browser_cls = NullBrowser
    +                        else:
    +                            browser_cls = target_browser_cls
    +
    +                        browser_kwargs = get_browser_kwargs(test_type,
    +                                                            run_info,
    +                                                            ssl_env=ssl_env,
    +                                                            config=test_environment.config,
    +                                                            **kwargs)
    +
    +                        executor_cls = executor_classes.get(test_type)
    +                        executor_kwargs = get_executor_kwargs(test_type,
    +                                                              test_environment.config,
    +                                                              test_environment.cache_manager,
    +                                                              run_info,
    +                                                              **kwargs)
    +
    +                        if executor_cls is None:
    +                            logger.error("Unsupported test type %s for product %s" %
    +                                         (test_type, product))
    +                            continue
    +
    +                        for test in test_loader.disabled_tests[test_type]:
    +                            logger.test_start(test.id)
    +                            logger.test_end(test.id, status="SKIP")
    +
    +                        if test_type == "testharness":
    +                            run_tests = {"testharness": []}
    +                            for test in test_loader.tests["testharness"]:
    +                                if test.testdriver and not executor_cls.supports_testdriver:
    +                                    logger.test_start(test.id)
    +                                    logger.test_end(test.id, status="SKIP")
    +                                elif test.jsshell and not executor_cls.supports_jsshell:
    +                                    # We expect that tests for JavaScript shells
    +                                    # will not be run along with tests that run in
    +                                    # a full web browser, so we silently skip them
    +                                    # here.
    +                                    pass
    +                                else:
    +                                    run_tests["testharness"].append(test)
    +                        else:
    +                            run_tests = test_loader.tests
    +
    +                        with ManagerGroup("web-platform-tests",
    +                                          kwargs["processes"],
    +                                          test_source_cls,
    +                                          test_source_kwargs,
    +                                          browser_cls,
    +                                          browser_kwargs,
    +                                          executor_cls,
    +                                          executor_kwargs,
    +                                          kwargs["rerun"],
    +                                          kwargs["pause_after_test"],
    +                                          kwargs["pause_on_unexpected"],
    +                                          kwargs["restart_on_unexpected"],
    +                                          kwargs["debug_info"]) as manager_group:
    +                            try:
    +                                manager_group.run(test_type, run_tests)
    +                            except KeyboardInterrupt:
    +                                logger.critical("Main thread got signal")
    +                                manager_group.stop()
    +                                raise
    +                        test_count += manager_group.test_count()
    +                        unexpected_count += manager_group.unexpected_count()
    +
    +                    test_total += test_count
    +                    unexpected_total += unexpected_count
    +                    logger.info("Got %i unexpected results" % unexpected_count)
    +                    if repeat_until_unexpected and unexpected_total > 0:
    +                        break
    +                    logger.suite_end()
     
         if test_total == 0:
             logger.error("No tests ran")
  7. added
    C-has-patch
    on May 22, 2018
  8. added a commit that references this issue on May 22, 2018
  9. jdm commented on May 23, 2018

    @jdm
    MemberAuthor
    Exception in processing request from: ('::ffff:127.0.0.1', 59231, 0, 0)
    Traceback (most recent call last):
      File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 596, in process_request_thread
        self.finish_request(request, client_address)
      File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 331, in finish_request
        self.RequestHandlerClass(request, client_address, self)
      File "/Users/servo/buildbot/slave/mac-rel-wpt2/build/tests/wpt/web-platform-tests/tools/pywebsocket/mod_pywebsocket/standalone.py", line 697, in __init__
        self, request, client_address, server)
      File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 652, in __init__
        self.handle()
      File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 342, in handle
        self.handle_one_request()
      File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 310, in handle_one_request
        self.raw_requestline = self.rfile.readline(65537)
      File "/Users/servo/buildbot/slave/mac-rel-wpt2/build/tests/wpt/web-platform-tests/tools/pywebsocket/mod_pywebsocket/memorizingfile.py", line 89, in readline
        line = self._file.readline()
      File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 434, in readline
        data = recv(1)
    error: [Errno 54] Connection reset by peer
    
  10. added 4 commits that reference this issue on May 31, 2018
  11. jdm commented on Jun 7, 2018

    @jdm
    MemberAuthor

    web-platform-tests/wpt#11299 did not help, unfortunately.

  12. 8 remaining items

  13. added 9 commits that reference this issue on Jun 7, 2018
  14. jdm commented on Jun 12, 2018

    @jdm
    MemberAuthor

    So, following up on the anecdotal data suggesting that:

    • this problem started occurring sometime between April 25 and April 28
    • this problem was introduced by a WPT sync

    I ran some repeated try jobs in #21033. The results strongly suggest that web-platform-tests/wpt@2ae9668 is the cause of the problem (ironically, since it sounds like it fixed a similar kind of problem for Gecko). @jgraham what's the next step here?

  15. added 3 commits that reference this issue on Jun 15, 2018
  16. Eijebong commented on Oct 11, 2018

    @Eijebong
    Contributor

    This has been fixed now :)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-testingC-has-patchI-intermittent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions