Skip to content
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

Real Time database cannot reconnect #35

Closed
nikolaypogrebnoy opened this issue Jan 9, 2017 · 7 comments
Closed

Real Time database cannot reconnect #35

nikolaypogrebnoy opened this issue Jan 9, 2017 · 7 comments

Comments

@nikolaypogrebnoy
Copy link

Dears,
I've met issue with re-connection to database. Time by time re-connection is unsuccessful with this error message: "Firebase.Database.Internal.TubeSock.WebSocketException: IO Exception ---> System.IO.IOException: IO exception during Write. ---> System.ObjectDisposedException: The object was used after being disposed."

Please check the log for more detalies:

I/Unity ( 1137): WebSocket:ws_1 - had an error
I/Unity ( 1137): Firebase.Database.Internal.TubeSock.WebSocketException: IO Error ---> System.IO.IOException: EndRead failure ---> System.Net.Sockets.SocketException: Connection timed out
I/Unity ( 1137): at System.Net.Sockets.Socket SocketAsyncResult.CheckIfThrowDelayedException () [0x00000] in :0
I/Unity ( 1137): at System.Net.Sockets.Socket.EndReceive (IAsyncResult asyncResult, System.Net.Sockets.SocketError& errorCode) [0x00000] in :0
I/Unity ( 1137): at System.Net.Sockets.Socket.EndReceive (IAsyncResult result) [0x00000] in :0
I/Unity ( 1137): at System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar) [0x00000] in :0
I/Unity ( 1137): --- End of inner exception stack trace ---
I/Unity ( 1137): (Filename: ./artifacts/generated/common/runtim
I/Unity ( 1137): WebSocket:ws_1 - |IO Error|
I/Unity ( 1137): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
I/Unity ( 1137): WebSocket:ws_1 - closing itself
I/Unity ( 1137): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
I/Unity ( 1137): Connection:conn_1 - Realtime connection lost
I/Unity ( 1137): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
I/Unity ( 1137): Connection:conn_1 - closing realtime connection
I/Unity ( 1137): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
I/Unity ( 1137): PersistentConnection:pc_0 - Got on disconnect due to Other
I/Unity ( 1137): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
I/Unity ( 1137): PersistentConnection:pc_0 - Scheduling connection attempt
I/Unity ( 1137): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
I/Unity ( 1137): ConnectionRetryHelper:Scheduling retry in %dms
I/Unity ( 1137): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
I/Unity ( 1137): EventRaiser:Raising 1 event(s)
I/Unity ( 1137): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
I/Unity ( 1137): WebSocket:ws_1 - closed
I/Unity ( 1137): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
I/Unity ( 1137): WebSocket:ws_1 - had an error
I/Unity ( 1137): Firebase.Database.Internal.TubeSock.WebSocketException: IO Exception ---> System.IO.IOException: IO exception during Write. ---> System.ObjectDisposedException: The object was used after being disposed.
I/Unity ( 1137): at System.Net.Sockets.NetworkStream.CheckDisposed () [0x00000] in :0
I/Unity ( 1137): at System.Net.Sockets.NetworkStream.BeginWrite (System.Byte[] buffer, Int32 offset, Int32 size, System.AsyncCallback callback, System.Object state) [0x00000] in :0
I/Unity ( 1137): at Mono.Security.Protocol.Tls.SslStreamBase.InternalBeginWrite (Mono.Security.Protocol.Tls.InternalAsyncResult asyncResult) [0x00000] in :0
I/Unity ( 1137): --- End of inner exception stack trace ---
I/Unity ( 1137): at Mono.Security.Protocol.Tls.SslStreamBase.InternalBeginWrite (Mono.Security.Protocol.Tls.InternalAsyncResult asyncResult) [0x00000] in :0
I/Unity ( 1137): at Mono.Security.Protocol.Tls.SslStreamBase.BeginWrite (System.Byte[] buffer, Int32 offset, Int32 count, System.AsyncCallback callback, System.Obj
I/Unity ( 1137): WebSocket:ws_1 - |IO Exception
I/Unity ( 1137): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
I/Unity ( 1137): EventRaiser:Raising /.info/connected: Value: False

Thank you!

@nikolaypogrebnoy nikolaypogrebnoy changed the title RealTime daba base can not reconect after connection loose Real Time database cannot reconnect Jan 9, 2017
@benwulfe
Copy link

benwulfe commented Jan 9, 2017

Hi -- would you be able to give a few more details on how the disconnect and reconnect is happening?
are you turning on airplane mode, calling GoOffline(), etc?

@nikolaypogrebnoy
Copy link
Author

Hi, I'm using example from quickstart-unity-master\database\testapp. With some minor changes in UI.

I'm getting this issue only on android phone Lg G3, not on PC.

In one session I have a multiple disconnection and auto reconnection (screenshot attached). I do not call GoOffline(), the reason of this disconnection I beleive unstable Internet connection or some other thing related to internal library logic.

screenshot_2017-01-09-23-15-59

This code shows connect|disconnect events:

FirebaseDatabase.DefaultInstance.GetReference(".info/connected").ValueChanged = Chat_ValueChanged;

private void Chat_ValueChanged(object sender, ValueChangedEventArgs e)
{
    Debug.Log(e.Snapshot.Value);
...
}

It's work fine till I get exception from my first message.

After that auto reconnect does not work. Calling GoOnline() from code gives the same exception in log.

@benwulfe
Copy link

benwulfe commented Jan 9, 2017

Have you logged in with someone with permissions to the database? What are your security rules?

Do you get this issue with the quickstart without any changes? (make your database temporarily open and run it on the Lg G3 with the original source code).

@nikolaypogrebnoy
Copy link
Author

My DB rules:
{
"rules": {
".read": "auth == null",
".write": "auth == null",
"Rome": {
".indexOn": ["datetime"]
}
}
}
Let me try to get this error with the quickstart without any changes. Not sure that will be fast because this error very unstable. My app can work some time perfectly till I get this error.

@stewartmiles
Copy link
Contributor

Does this issue this occur with plugin 1.1.2 https://firebase.google.com/support/release-notes/unity#1.1.2 ?

@stewartmiles
Copy link
Contributor

We've extensively tested connection in 1.1.2 and 3.0.0, please check out the latest release https://firebase.google.com/support/release-notes/unity#3.0.0

@mnasir41
Copy link

".read": "auth == null",
".write": "auth == null",
You DB rules states that no authenticated user should access your DB..
Try these rules if you want DB accessible for everyone..
".read": "true",
".write": "true",

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants