dart-lang / dart-lang/webdev

flutter web app reporting websockectconnectionclosed

Open
#2,753 8 comments 1 reaction 0 assignees View on GitHub
P2 package:dwds triaged
Dominant language
Dart
Stars
224
Forks
94
Avg merge
4d 3h
Merged PRs (30d)
2

Description

So the below error.

A couple of notes.

The app is doing continuous polling of the server to display log messages (the tool is a log observation front end).
The app allows you to 'tear off' a log window and open another browser window/tab tailing the selected log.

The error is only happening in the main app window (not the tear off).

I tried restarting the app and creating a new tear off - that wasn't enough to reproduce the problem and at the moment
I don't have an understanding of how to reproduce it.

I'm not seeing any errors in the chrome dev tools network window.
The errors are being reported in the dev tools console and also in the terminal cli that I launch the front end.

The front end still appears to be working without issue. The front end does 6 http request every couple of seconds the below error is output at about the same rate, but doesn't seem to correspond to a particular http request.

The code is currently in a private repo but I do intend to make it public if access to the code would be helpful.

```
[frontend] Unhandled error detected in the injected client.js script.

You can disable this script in webdev by passing --no-injected-client if it
is preventing your app from loading, but note that this will also prevent
all debugging and hot reload/restart functionality from working.

The original error is below, please file an issue at
https://github.com/dart-lang/webdev/issues/new and attach this output:

WebSocketConnectionClosed: Connection Closed

at Object.throwExpression (http://localhost:8788/dwds/src/injected/client.js:1312:64)
at PersistentWebSocket._writeToWebSocket$1 (http://localhost:8788/dwds/src/injected/client.js:24827:13)
at tear_off. (http://localhost:8788/dwds/src/injected/client.js:1637:45)
at StaticClosure._rootRunUnary (http://localhost:8788/dwds/src/injected/client.js:4317:18)
at _CustomZone.runUnary$2$2 (http://localhost:8788/dwds/src/injected/client.js:15140:39)
at _CustomZone.runUnaryGuarded$1$2 (http://localhost:8788/dwds/src/injected/client.js:15087:14)
at _ControllerSubscription._sendData$1 (http://localhost:8788/dwds/src/injected/client.js:14587:19)
at _DelayedData.perform$1 (http://localhost:8788/dwds/src/injected/client.js:14762:59)
at _PendingEvents_schedule_closure.call$0 (http://localhost:8788/dwds/src/injected/client.js:14821:14)
at StaticClosure._rootRun (http://localhost:8788/dwds/src/injected/client.js:4298:18)
at _CustomZone.run$1$1 (http://localhost:8788/dwds/src/injected/client.js:15132:39)
at _CustomZone.runGuarded$1 (http://localhost:8788/dwds/src/injected/client.js:15075:14)
at _CustomZone_bindCallbackGuarded_closure.call$0 (http://localhost:8788/dwds/src/injected/client.js:15264:25)
at StaticClosure._rootRun (http://localhost:8788/dwds/src/injected/client.js:4302:16)
at _CustomZone.run$1$1 (http://localhost:8788/dwds/src/injected/client.js:15132:39)
at _CustomZone.runGuarded$1 (http://localhost:8788/dwds/src/injected/client.js:15075:14)
at _CustomZone_bindCallbackGuarded_closure.call$0 (http://localhost:8788/dwds/src/injected/client.js:15264:25)
at Object._microtaskLoop (http://localhost:8788/dwds/src/injected/client.js:4148:24)
at StaticClosure._startMicrotaskLoop (http://localhost:8788/dwds/src/injected/client.js:4154:11)
at _AsyncRun__initializeScheduleImmediate_internalCallback.call$1 (http://localhost:8788/dwds/src/injected/client.js:13521:9)

```

Contributor guide

Open the contributing guide

Research direction

Start by examining the injected client.js stack trace and the DWDS WebSocket handling involved in PersistentWebSocket._writeToWebSocket$1. Try to reproduce the failure with a Flutter web app that continuously polls, uses a tear-off log window, and reports WebSocketConnectionClosed; done means the main window no longer emits an unhandled error when the connection closes.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.