sdk icon indicating copy to clipboard operation
sdk copied to clipboard

dart:io#WebSocket: Low-level protocol error (1002) occurs

Open matanlurey opened this issue 7 years ago • 7 comments

This is going to be a tough one to debug, as it only happens to me after a few hours of usage, but I'm happy to add any debugging/test versions of the VM/SDK in order to help debug this as much as possible - or copying the Socket-implemented code and adding instrumentation.

Basically, after a few hours of connection, WebSocket.onDone completes with no error message, but an error code of 1002, which from a few searches seems to be from a "low-level protocol error" - i.e. likely not user code, but I could br wrong.

Here is a snippet of my code (very light wrapper around dart:io):

https://github.com/matanlurey/din/blob/d08f9c36932f74d8fb8abb7fd7527a47eafe075d/lib/platform/vm.dart#L72-L108

I'm running it on GCE (Google Compute Engine), and my dart --version is: Dart VM version: 2.0.0-dev.4.0 (Wed Oct 18 16:35:12 2017) on "linux_x64"

(I'm going to update to latest now to see if that solves the issue)

matanlurey avatar Dec 23 '17 19:12 matanlurey

I am now running at Dart VM version: 2.0.0-dev.14.0 (Unknown timestamp) on "linux_x64"

... and will update this thread if the problem goes away.

matanlurey avatar Dec 23 '17 20:12 matanlurey

Nope, still got a crash :-/

matanlurey avatar Dec 25 '17 06:12 matanlurey

@matanlurey Did you manage to find a solution for this? I'm having the same problem, except that I got the unexpected close with code 1002 within a few minutes of connection, usually after a short period of inactivity.

daniel-mf avatar Jun 22 '21 11:06 daniel-mf

@daniel-mf did you manage to find a fix for this? I am also having the same problem

Jerome-Saltmarsh avatar Mar 16 '22 01:03 Jerome-Saltmarsh

@Jerome-Saltmarsh Unfortunately not. It has been a long time since I last worked at this, but my project still struggles with this issue. I'll probably end up migrating to some other library. I'll be really sorry to do that cause I enjoy coding in Dart so much.

daniel-mf avatar Mar 16 '22 02:03 daniel-mf

I actually figured out what that it wasn't a code related issue. Rather my deployment configuration had a timeout of 300 seconds (I'm using google cloud run). Increasing this value resolved the issue for me.

Jerome-Saltmarsh avatar Mar 16 '22 08:03 Jerome-Saltmarsh

Same problem.

chenenyu avatar Aug 08 '22 02:08 chenenyu