Skip to content

Fix web tests on Linux #2147

Closed
Closed

Description

@DanTup

Web tests always fail on Linux on GH Actions with the error below.

Wondering if this is similar to an issue seen in DevTools where running non-headless Chrome would fail on Linux Travis:

flutter/devtools@2567fd6

However, I can't figure out why the web tests for Flutter would work fine (or if there's a way to force headless mode for the webdev daemon to test if that helps). Disabling these tests on Linux for now and need to restore when I can find a fix.

[11:22:34 AM] [WebDaemon] [Info] [Dart & Flutter] <== [{"event":"daemon.log","params":{"log":"[INFO] ------------------------------------------------------------------------\n"}}]
[11:22:34 AM] [General] [Info] [stdout] [INFO] ------------------------------------------------------------------------
[11:22:40 AM] [WebDaemon] [Error] [Dart & Flutter] Unhandled exception:
Instance of 'AppConnectionException'
#0      DevHandler.startDebugService (package:dwds/src/handlers/dev_handler.dart:147:7)
<asynchronous suspension>
#1      DevHandler.loadAppServices.<anonymous closure> (package:dwds/src/handlers/dev_handler.dart:177:19)
<asynchronous suspension>
#2      _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:291:23)
#3      DevHandler.loadAppServices (package:dwds/src/handlers/dev_handler.dart:175:24)
#4      Dwds.debugConnection (package:dwds/dwds.dart:54:46)
<asynchronous suspension>
#5      AppDomain._handleAppConnections (package:webdev/src/daemon/app_domain.dart:63:40)
<asynchronous suspension>
#6      SetMixin.forEach (dart:collection/set.dart:146:30)
#7      AppDomain._initialize (package:webdev/src/daemon/app_domain.dart:56:27)
#8      new AppDomain (package:webdev/src/daemon/app_domain.dart:128:5)
#9      DaemonCommand.run (package:webdev/src/command/daemon_command.dart:107:29)
<asynchronous suspension>
#10     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
<asynchronous suspension>
#11     _CommandRunner.runCommand (package:webdev/src/webdev_command_runner.dart:38:24)
<asynchronous suspension>
#12     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#13     new Future.sync (dart:async/future.dart:224:31)
#14     CommandRunner.run (package:args/command_runner.dart:112:14)
#15     run (package:webdev/src/webdev_command_runner.dart:19:56)
#16     main (file:///home/runner/.pub-cache/hosted/pub.dartlang.org/webdev-2.5.4/bin/webdev.dart:17:22)
<asynchronous suspension>
#17     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:303:32)
#18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

Activity

  1. added this to the On Deck milestone on Dec 5, 2019
  2. DanTup commented on Dec 5, 2019

    @DanTup
    MemberAuthor

    @grouma do you have any ideas about this? I definitely saw issues on Linux Travis with Chrome when running DevTools tests without using headless (it seemed like Chrome never launched properly). This feels like it might be the same, but I'm not sure why it would work when going through Flutter (the flutter web tests work, but these webdev daemon ones don't).

  3. DanTup commented on Dec 5, 2019

    @DanTup
    MemberAuthor

    Spoke too soon - had it on macOS too. Maybe just intermittent :(

    [3:48:38 PM] [WebDaemon] [Info] [Dart & Flutter] <== [{"event":"daemon.log","params":{"log":"[INFO] Caching finalized dependency graph..."}}]
    [3:48:38 PM] [General] [Info] [stdout] [INFO] Caching finalized dependency graph...
    [3:48:38 PM] [WebDaemon] [Info] [Dart & Flutter] <== [{"event":"daemon.log","params":{"log":"[INFO] Caching finalized dependency graph completed, took 625ms\n"}}]
    [3:48:38 PM] [General] [Info] [stdout] [INFO] Caching finalized dependency graph completed, took 625ms
    [3:48:38 PM] [WebDaemon] [Info] [Dart & Flutter] <== [{"event":"daemon.log","params":{"log":"[INFO] Succeeded after 3m 10s with 6014 outputs (13194 actions)\n"}}]
    [3:48:38 PM] [General] [Info] [stdout] [INFO] Succeeded after 3m 10s with 6014 outputs (13194 actions)
    [3:48:38 PM] [WebDaemon] [Info] [Dart & Flutter] <== [{"event":"daemon.log","params":{"log":"[INFO] ------------------------------------------------------------------------\n"}}]
    [3:48:38 PM] [General] [Info] [stdout] [INFO] ------------------------------------------------------------------------
    [3:48:45 PM] [WebDaemon] [Error] [Dart & Flutter] Unhandled exception:
    Instance of 'AppConnectionException'
    [3:48:45 PM] [General] [Info] [stderr] Unhandled exception:
    Instance of 'AppConnectionException'
    [3:48:45 PM] [WebDaemon] [Error] [Dart & Flutter] #0      DevHandler.startDebugService (package:dwds/src/handlers/dev_handler.dart:147:7)
    <asynchronous suspension>
    #1      DevHandler.loadAppServices.<anonymous closure> (package:dwds/src/handlers/dev_handler.dart:177:19)
    <asynchronous suspension>
    #2      _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:291:23)
    #3      DevHandler.loadAppServices (package:dwds/src/handlers/dev_handler.dart:175:24)
    #4      Dwds.debugConnection (package:dwds/dwds.dart:54:46)
    <asynchronous suspension>
    #5      AppDomain._handleAppConnections (package:webdev/src/daemon/app_domain.dart:63:40)
    <asynchronous suspension>
    #6      SetMixin.forEach (dart:collection/set.dart:146:30)
    #7      AppDomain._initialize (package:webdev/src/daemon/app_domain.dart:56:27)
    #8      new AppDomain (package:webdev/src/daemon/app_domain.dart:128:5)
    #9      DaemonCommand.run (package:webdev/src/command/daemon_command.dart:107:29)
    <asynchronous suspension>
    #10     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
    <asynchronous suspension>
    #11     _CommandRunner.runCommand (package:webdev/src/webdev_command_runner.dart:38:24)
    <asynchronous suspension>
    #12     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
    #13     new Future.sync (dart:async/future.dart:224:31)
    #14     CommandRunner.run (package:args/command_runner.dart:112:14)
    #15     run (package:webdev/src/webdev_command_runner.dart:19:56)
    #16     main (file:///Users/runner/.pub-cache/hosted/pub.dartlang.org/webdev-2.5.4/bin/webdev.dart:17:22)
    <asynchronous suspension>
    #17     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:303:32)
    #18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
    
  4. grouma commented on Dec 5, 2019

    @grouma
    Member

    So this error is thrown here:
    https://github.com/dart-lang/webdev/blob/2dfe6830e9692b54d2f0b214a186175cdf159b25/dwds/lib/src/handlers/dev_handler.dart#L147

    It means that a debug session was initiated but we couldn't find a Dart application in the connected Chrome instance. More specifically, we couldn't find this embedded data:
    https://github.com/dart-lang/webdev/blob/master/dwds/lib/src/handlers/injected_handler.dart#L108

    My suggestion is to do some logging to ensure that the injected handler is actually embedding the metadata. Depending on the result I may have some other ideas.

  5. DanTup commented on Dec 5, 2019

    @DanTup
    MemberAuthor

    Could it be that the page just hasn't loaded yet? (or even Chrome itself)? These GitHub machines are super-slow, and I noticed there's a timeout in that code:

    https://github.com/dart-lang/webdev/blob/2dfe6830e9692b54d2f0b214a186175cdf159b25/dwds/lib/src/handlers/dev_handler.dart#L128-L129

    do some logging to ensure that the injected handler is actually embedding the metadata

    I'm not sure where to put this since it's all internal to webdev. Is there a convenient way to add debug logging (and have it spat out to stdout so it'll show in my CI logs?).

  6. grouma commented on Dec 5, 2019

    @grouma
    Member

    It's unlikely because startDebugServices requires an AppConnection which requires an established SSE connection. In fact, I retract my previous comment. The injection handler must have properly run to get an AppConection. It's possible that the debug event for the execution context has not been received yet. Feel free to play with that timeout to see if it reduces flakiness. We can extend it, just not substantially, because we do need to eventually return an error if the tab does not contain a Dart application.

  7. added a commit that references this issue on Dec 9, 2019
  8. modified the milestones: On Deck, v3.12.0 on May 26, 2020
  9. added a commit that references this issue on May 26, 2020
    fe8723a
  10. modified the milestones: v3.12.0, v3.11.0 on May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions