Skip to content

Offline users can get an infinite loop of reconnect attempts #2883

@freebeartogoodhome

Description

@freebeartogoodhome

What is the problem?

If an offline user ever uses engine analysis they will open a socket. That will end up triggering this part of socket.dart

        onStreamCancel: () {
          if (_isDisposed) return;
          // Schedule the socket to be closed if idle, after a short delay to
          // avoid unnecessary reconnections.
          _disposeTimers[route]?.cancel();
          _disposeTimers[route] = Timer(idleTimeout, () {
            _logger.fine('Disposing idle socket on $route.');
            _pool[route]?.dispose();
            _pool.remove(route);
            // if during the idle time no new socket is requested, we reconnect
            // the default socket
            if (route == _currentRoute) {
              _currentRoute = Uri(path: kDefaultSocketRoute);
              if (!currentClient.isActive) {
                currentClient.connect();
              }
            }

That will loop attempts to reconnect a websocket until the user goes online or closes the app.

Steps to reproduce the bug

Use engine analysis while offline.

App version

0.22.7

Device Info

Android emulator

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions