vukoye / xmpp_dart

Lightweight XMPP client library written in Dart
Apache License 2.0
83 stars 64 forks source link

Error after bind resource - Unhandled Exception: Bad state: Cannot add event after closing #17

Closed TatankaConCube closed 4 years ago

TatankaConCube commented 4 years ago

Hello guys, you are cool team and you did big work for implementation xmpp protocol on dart. Today I updated xmpp_stone to lates version (0.2.2) and I got unexpected issue, below detaile information about it.

Version: 0.2.2 Code to reproduce:

import 'package:xmpp_stone/xmpp_stone.dart' as xmpp;
...

String userJid = ""; // full user jid
xmpp.XmppAccountSettings accountSettings = xmpp.XmppAccountSettings.fromJid(userJid, password);

xmpp.Connection  _connection = xmpp.Connection.getInstance(accountSettings);

_connection.connect();

Error trace:

E/flutter ( 5677): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: Cannot add event after closing
E/flutter ( 5677): #0      _StreamController.add (dart:async/stream_controller.dart:596:24)
E/flutter ( 5677): #1      ConnectionNegotiator.state= (package:xmpp_stone/src/features/Negotiator.dart:24:37)
E/flutter ( 5677): #2      StreamManagementModule.negotiate (package:xmpp_stone/src/features/streammanagement/StreamManagmentModule.dart:91:7)
E/flutter ( 5677): #3      ConnectionNegotatiorManager.negotiateNextFeature (package:xmpp_stone/src/features/ConnectionNegotatiorManager.dart:85:21)
E/flutter ( 5677): #4      ConnectionNegotatiorManager.stateListener (package:xmpp_stone/src/features/ConnectionNegotatiorManager.dart:117:7)
E/flutter ( 5677): #5      _rootRunUnary (dart:async/zone.dart:1192:38)
E/flutter ( 5677): #6      _CustomZone.runUnary (dart:async/zone.dart:1085:19)
E/flutter ( 5677): #7      _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)
E/flutter ( 5677): #8      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter ( 5677): #9      _DelayedData.perform (dart:async/stream_impl.dart:594:14)
E/flutter ( 5677): #10     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:710:11)
E/flutter ( 5677): #11     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:670:7)
E/flutter ( 5677): #12     _rootRun (dart:async/zone.dart:1180:38)
E/flutter ( 5677): #13     _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter ( 5677): #14     _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter ( 5677): #15     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
E/flutter ( 5677): #16     _rootRun (dart:async/zone.dart:1184:13)
E/flutter ( 5677): #17     _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter ( 5677): #18     _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter ( 5677): #19     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
E/flutter ( 5677): #20     _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
E/flutter ( 5677): #21     _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
E/flutter ( 5677): 

Full log: stone_xmpp_error_log

vukoye commented 4 years ago

Looks like server closed the socket and lib is trying to use it. Can you please check is this reproducible for you with 0.2.1?

TatankaConCube commented 4 years ago

Please wait few minutes, I should rebuild project and collect logs. FYI: In version 0.1.5 it worked fine, but was issue after logout and login again, if need I will collect needed logs.

TatankaConCube commented 4 years ago

I got the same error in version 0.2.1 (((

vukoye commented 4 years ago

Thanks, sorry to hear that, I will try to figure out what's going on.

TatankaConCube commented 4 years ago

one moment, please, looks like I was mistake when changed version to 0.2.1, but flutter used 0.2.2, I will clean caches and answer later.

TatankaConCube commented 4 years ago

I got next error when change version to 0.2.1, can you please help me to resolve it

Because every version of xmpp_stone depends on image ^2.0.7 which depends on xml ^3.2.5, every version of xmpp_stone requires xml ^3.2.5.

So, because app depends on xmpp_stone 0.2.1 which depends on xml ^4.1.0, version solving failed.
pub upgrade failed (1; So, because app depends on xmpp_stone 0.2.1 which depends on xml ^4.1.0, version solving failed.)
vukoye commented 4 years ago

Sorry for tht. 0.2.1 had some dependency issues, try 0.2.0

TatankaConCube commented 4 years ago

The same issue in version 0.2.0 ((( But in logs I can see incoming packages, looks like connection was established but callback XmppConnectionState.Ready wasn't called.

TatankaConCube commented 4 years ago

If you, guys need any help for testing this issue, you can ask me and I will try to help you.

vukoye commented 4 years ago

One more question, if you have some test accounts for your server, can you please sent it to my email address nemanja.vukoje@gmail.com I can not reproduce it on mine, it will be easier to fix the issue.

TatankaConCube commented 4 years ago

I sent needed informations on your e-mail, thank you for support.

vukoye commented 4 years ago

Can you please check the latest version 0.2.3?

TatankaConCube commented 4 years ago

@vukoye thank you for your support, now login works fine. But now I have another issue, I will create new ticket.