Skip to content

Pubnub Error at the time of internet turning OFF. (Windows Desktop) #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
unoravi opened this issue Dec 21, 2020 · 18 comments
Closed

Pubnub Error at the time of internet turning OFF. (Windows Desktop) #29

unoravi opened this issue Dec 21, 2020 · 18 comments
Assignees
Labels
status: done This issue is considered resolved. type: bug This issue reports a bug.

Comments

@unoravi
Copy link

unoravi commented Dec 21, 2020

Flutter-Channel : dev

Note : Same code works properly for Android but not working on Windows Desktop.

Flutter Doctor :

`
[√] Flutter (Channel dev, 1.26.0-1.0.pre, on Microsoft Windows [Version 10.0.18363.1016], locale en-CA)
• Flutter version 1.26.0-1.0.pre at C:\Program Files\flutter
• Framework revision 63062a6443 (8 days ago), 2020-12-13 23:19:13 +0800
• Engine revision 4797b06652
• Dart version 2.12.0 (build 2.12.0-141.0.dev)

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\street\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.7)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.7.30621.155
• Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• 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 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.52.1)
• VS Code at C:\Users\street\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.17.0

[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.18363.1016]
• Chrome (web) • chrome • web-javascript • Google Chrome 87.0.4280.88
• Edge (web) • edge • web-javascript • Microsoft Edge 85.0.564.70

! Doctor found issues in 1 category.
`

Error is shown below.

[+98719 ms] [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PubNubException: request failed
[ +1 ms] #0 new PubNubException (package:pubnub/src/core/exceptions.dart:9:29)
[ ] #1 new PubNubRequestOtherException (package:pubnub/src/core/net/exceptions.dart:21:56)
[ ] #2 RequestHandler.response (package:pubnub/src/net/request_handler.dart:82:17)
[ +18 ms]
[ ] #3 Future.any.onValue (dart:async/future.dart)
[ ]
[ ] #0 RequestHandler.response (package:pubnub/src/net/request_handler.dart:82:11)
[ ]
[ ] #1 Future.any.onValue (dart:async/future.dart)
[ +1 ms]

@unoravi unoravi changed the title Pubnub Error at the time of internet turns OFF. (Windows Desktop) Pubnub Error at the time of internet turning OFF. (Windows Desktop) Dec 21, 2020
@are
Copy link
Contributor

are commented Jan 8, 2021

Hi! Thanks for reporting the issue. This may be caused by some unrecognized exception thats throwing off builtin diagnostics. However, it may be possible to fix this by adding your own diagnostic function:

import `package:pubnub/core.dart`;
import 'package:pubnub/src/networking/meta/diagnostics.dart';

pubnub.supervisor.registerDiagnostic((exception) {
  if (exception is Exception) { // check what kind of exception that is
    return HostIsDownDiagnostic('ps.pndsn.com', 80); // example diagnostic
    // you can also use UnknownHttpExceptionDiagnostic()
  }
});

@are are self-assigned this Jan 8, 2021
@are are added status: waiting This issue waits for feedback from author. type: bug This issue reports a bug. labels Jan 8, 2021
@unoravi
Copy link
Author

unoravi commented Jan 11, 2021

@are

I have used this code and start application. On internet disconnection, I got exception : "PubNubException: request failed". Flutter Doctor and code details are still same as display earlier. Please let me know if you need anymore details.

Thanks

@are
Copy link
Contributor

are commented Jan 15, 2021

Can you print out and let me know what kind of exception is passed into the registerDiagnostic callback?
For example:

print(exception);
print(exception.runtimeType);

@unoravi
Copy link
Author

unoravi commented Jan 18, 2021

Hello,

Here is the result of below code.

pubnub.supervisor.registerDiagnostic((exception) {
        print("Exception : $exception");
        print("Exception Runtime Type : ${exception.runtimeType}");
      });

Result :

Exception : PubNubException: request failed
[        ] #0      new PubNubException (package:pubnub/src/core/exceptions.dart:9:29)
[        ] #1      new PubNubRequestOtherException (package:pubnub/src/core/net/exceptions.dart:21:56)
[  +13 ms] #2      RequestHandler.response (package:pubnub/src/net/request_handler.dart:82:17)
[        ] <asynchronous suspension>
[        ] #3      Future.any.onValue (dart:async/future.dart)
[        ] <asynchronous suspension>
[        ] flutter: Exception Runtime Type : PubNubRequestOtherException
[   +1 ms] [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PubNubException: request failed
[   +3 ms] #0      new PubNubException (package:pubnub/src/core/exceptions.dart:9:29)
[   +1 ms] #1      new PubNubRequestOtherException (package:pubnub/src/core/net/exceptions.dart:21:56)
[   +1 ms] #2      RequestHandler.response (package:pubnub/src/net/request_handler.dart:82:17)
[        ] <asynchronous suspension>
[        ] #3      Future.any.onValue (dart:async/future.dart)
[        ] <asynchronous suspension>
[        ] #0      RequestHandler.response (package:pubnub/src/net/request_handler.dart:82:11)
[   +1 ms] <asynchronous suspension>
[        ] #1      Future.any.onValue (dart:async/future.dart)
[        ] <asynchronous suspension>

Please let me know if any.

Thanks

@are
Copy link
Contributor

are commented Feb 5, 2021

Sorry for not being able to resolve this issue quickly, but you have to keep in mind that Flutter on Windows is in alpha and not everything will work correctly. This issue may be fixed by our next release next week, but it doesn't guarantee that.

@unoravi
Copy link
Author

unoravi commented Feb 8, 2021

@are
Thank you so much for the info. I will keep checking upcoming releases and if in case you came to know the issue resolution release number then please share if you can..

@are
Copy link
Contributor

are commented Feb 16, 2021

We have released new version 3.1.0. Can you let us know if the issue persists?

@unoravi
Copy link
Author

unoravi commented Feb 17, 2021

@are
I have check this version (3.1.0) for Desktop Platforms. It resolved pubnub re-connection issue for Windows & Linux both. On windows, I can listen internet connect/disconnect on Windows but not able to listen the same on Linux. Here is the code used on both platforms.

_pubnub.signals.networkIsConnected.listen((isConnected) async {
	print("Network Update. Internet Connection Status : $isConnected");
});

At the time of internet ON-OFF, windows execute print statement but Linux doesn't execute print statement and doesn't react anything. Please suggest if any solution for this.

Thanks for on time support.

@unoravi
Copy link
Author

unoravi commented Feb 26, 2021

@are
Android, Windows and Linux devices are facing connection list once it goes idle for 4-5 hours. Pubnub configuration statements are as shown below. I have tried Exponential Network Policy too but issue remains the same.

var keySet = Keyset(subscribeKey: subscribeKey, publishKey: publishKey, uuid: UUID(DeviceUUID));

keySet.heartbeatInterval = 60; // in secs
     
_pubnub = PubNub(networking: NetworkingModule(retryPolicy: RetryPolicy.linear()), defaultKeyset: keySet);

Please suggest me the proper solution in which Pubnub stay connected for idle time at-least 24 hours.

Thanks

@are
Copy link
Contributor

are commented Feb 26, 2021

@unoravi What is the problem exactly? Do you get any exceptions? Does it just stop receiving messages without any information? What does the logging say?

@unoravi
Copy link
Author

unoravi commented Feb 26, 2021

@are
Yes, it just stop receiving messages without any information/signal/notification.. Application is not getting any kind of exception or logging for remote action. No response or reaction from Application side.

@are
Copy link
Contributor

are commented Feb 26, 2021

Can you enable logging on LogLevel.silly and send it here or if you are conscious of privacy send it to PubNub support and mention that its for me? Without any additional info it will be very hard to resolve this issue.

@unoravi
Copy link
Author

unoravi commented Mar 1, 2021

@are : Shared details on Pubnub Support and also mendtioned that it's for you (@are)

Thanks

@unoravi
Copy link
Author

unoravi commented Mar 2, 2021

@are : I faces connection lost issue and issue logs are attached on Pubnub Support Ticket...

@are
Copy link
Contributor

are commented Mar 2, 2021

I'm trying to analyze the logs and come up with something meaningful, but it's hard to say what is happening there.

One thing that you can try to do is to include a Timer that runs every n minutes (like 15, 30, 60) that calls the pubnub.reconnect() method. This will refresh the connections in case they go stale. It won't result in data loss so you can safely call it.

@are
Copy link
Contributor

are commented Mar 2, 2021

Also thanks to your latest logs we have found a bug! I'm in process of fixing it and this should allow your long running app to receive the messages properly.

@are are added status: accepted This issue is accepted as valid, but it's not being worked on yet. and removed status: waiting This issue waits for feedback from author. labels Mar 2, 2021
@unoravi
Copy link
Author

unoravi commented Mar 2, 2021

@are
Please let me know once done so that I can proceed further.

Thanks

@are
Copy link
Contributor

are commented Mar 11, 2021

Thanks for the long wait! Fix for this is released in 3.2.0. Let us know if you still run into this problem!

@are are closed this as completed Mar 11, 2021
@are are added status: done This issue is considered resolved. and removed status: accepted This issue is accepted as valid, but it's not being worked on yet. labels Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: done This issue is considered resolved. type: bug This issue reports a bug.
Projects
None yet
Development

No branches or pull requests

2 participants