centrifugal / centrifuge-dart

Dart (Flutter) client SDK for bidirectional communication with Centrifugo and Centrifuge-based server over WebSocket
https://pub.dartlang.org/packages/centrifuge
MIT License
113 stars 34 forks source link

Null check operator used on a null value (package:centrifuge/src/transport.dart:219:38) #66

Closed Amir-P closed 2 years ago

Amir-P commented 2 years ago

Here is what I get in my logs after trying to connect to a server (using v0.9.1).

      Null check operator used on a null value
      #0      Transport._onDone.<anonymous closure> (package:centrifuge/src/transport.dart:219:38)
      #1      _rootRun (dart:async/zone.dart:1418:47)
      #2      _CustomZone.run (dart:async/zone.dart:1328:19)
      #3      _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
      #4      _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:394:13)
      #5      _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:404:7)
      #6      _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
      #7      _SyncStreamControllerDispatch._sendDone (dart:async/stream_controller.dart:782:19)
      #8      _StreamController._closeUnchecked (dart:async/stream_controller.dart:637:7)
      #9      _StreamController.close (dart:async/stream_controller.dart:630:5)
      #10     new _WebSocketImpl._fromSocket.<anonymous closure> (dart:_http/websocket_impl.dart:1156:19)
      #11     _rootRunBinary (dart:async/zone.dart:1450:47)
      #12     _CustomZone.runBinary (dart:async/zone.dart:1342:19)
      #13     _CustomZone.runBinaryGuarded (dart:async/zone.dart:1252:7)
      #14     _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:360:15)
      #15     _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:375:9)
      #16     _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:280:7)
      #17     _SinkTransformerStreamSubscription._addError (dart:async/stream_transformers.dart:75:11)
      #18     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:113:7)
      #19     _rootRunUnary (dart:async/zone.dart:1434:47)
      #20     _CustomZone.runUnary (dart:async/zone.dart:1335:19)
      #21     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
      #22     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
      #23     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
      #24     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
      #25     _StreamController._add (dart:async/stream_controller.dart:648:7)
      #26     _StreamController.add (dart:async/stream_controller.dart:596:5)
      #27     _Socket._onData (dart:io-patch/socket_patch.dart:2314:41)
      #28     _rootRunUnary (dart:async/zone.dart:1442:13)
      #29     _CustomZone.runUnary (dart:async/zone.dart:1335:19)
      #30     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
      #31     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
      #32     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
      #33     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
      #34     _StreamController._add (dart:async/stream_controller.dart:648:7)
      #35     _StreamController.add (dart:async/stream_controller.dart:596:5)
      #36     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1839:33)
      #37     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1322:14)
      #38     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
      #39     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)

flutter doctor:

[✓] Flutter (Channel stable, 3.0.4, on macOS 12.4 21F79 darwin-arm, locale
    en-US)
    • Flutter version 3.0.4 at /Users/amirpanahandeh/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 85684f9300 (10 weeks ago), 2022-06-30 13:22:47 -0700
    • Engine revision 6ba2af10bb
    • Dart version 2.17.5
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/amirpanahandeh/SDK
    • Platform android-32, build-tools 30.0.3
    • ANDROID_HOME = /Users/amirpanahandeh/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2021.1.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 58.0.3
    • Dart plugin version 211.7727

[✓] VS Code (version 1.71.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.48.0

[✓] Connected device (3 available)
    • iPhone 13 (mobile) • C3B1EC66-7051-4848-ADB5-C35B94E63C3A • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)    • macos                                • darwin-arm64
      • macOS 12.4 21F79 darwin-arm
    • Chrome (web)       • chrome                               • web-javascript
      • Google Chrome 104.0.5112.101

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
FZambia commented 2 years ago

Hello, could you provide steps to reproduce? I can fix null check, but I do not understand under what circumstances we are hitting this - can not reproduce this locally.

alymbouras commented 1 year ago

This happens to me when the mobile device loses access to the internet.

FZambia commented 1 year ago

@alymbouras hello, this should be fixed as of 771634f332a93a6fc6d4cb0a6968a73bb4c4d171, if you got the exception in the latest version of lib please open a new issue with stack trace.