firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
822 stars 425 forks source link

Unity Editor crashes #230

Closed rusitschka closed 5 years ago

rusitschka commented 5 years ago

We're using Unity 2017.4.13 and when running our Game in Unity Editor it runs and stops ok. When the Unity Editor is left alone in the background it always crashes after roughly 5-10 minutes - without being used.

We always see this in the Editor logs directly after the crash:

Unloading 1076 unused Assets to reduce memory usage. Loaded Objects now: 32995.
Total: 63.005004 ms (FindLiveObjects: 3.721492 ms CreateObjectMapping: 2.516421 ms MarkObjects: 54.423291 ms  DeleteObjects: 2.342883 ms)

Mono.Security.Protocol.Tls.TlsException: Couldn't complete EndRead
  at Mono.Security.Protocol.Tls.SslStreamBase.EndRead (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
  at System.Net.Security.SslStream.EndRead (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
  at System.Net.Security.SslStream.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
  at System.IO.BinaryReader.ReadBytes (Int32 count) [0x00051] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/BinaryReader.cs:318
  at Firebase.Database.Internal.TubeSock.WebSocketReceiver.Read (System.Byte[] buffer, Int32 offset, Int32 length) [0x00000] in Z:\tmp\tmp.oTFxnTxwvi\firebase\database\client\mono\Database\Internal\TubeSock\WebSocketReceiver.cs:154
  at Firebase.Database.Internal.TubeSock.WebSocketReceiver.Run () [0x00018] in Z:\tmp\tmp.oTFxnTxwvi\firebase\database\client\mono\Database\Internal\TubeSock\WebSocketReceiver.cs:38
  at Firebase.Database.Internal.TubeSock.WebSocket.RunReader () [0x002c1] in Z:\tmp\tmp.oTFxnTxwvi\firebase\database\client\mono\Database\Internal\TubeSock\WebSocket.cs:466
  at Firebase.Database.Internal.TubeSock.WebSocket+Runnable101.Run () [0x00000] in Z:\tmp\tmp.oTFxnTxwvi\firebase\database\client\mono\Database\Internal\TubeSock\WebSocket.cs:516
  at Google.Sharpen.Thread.InternalRun () [0x00006] in Z:\tmp\tmp.uH6XvFGNmf\third_party\dotnet_src\sharpen\Sharpen\Thread.cs:80
Receiving unhandled NULL exception
Obtained 27 stack frames.
#0  0x00000168218928 in firebase::auth::Auth::GetAuth(firebase::App*, firebase::InitResult*)
#1  0x000001216b25fa in  (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE:FirebaseAuth_GetAuthInternal (System.Runtime.InteropServices.HandleRef,int&) + 0x11a (0x1216b24e0 0x1216b2646) [0x13b406660 - Unity Child Domain]
#2  0x000001216b22e9 in  Firebase.Auth.FirebaseAuth:GetAuthInternal (Firebase.FirebaseApp,Firebase.InitResult&) + 0xb9 (0x1216b2230 0x1216b24b7) [0x13b406660 - Unity Child Domain]
#3  0x000001216b2142 in  Firebase.Auth.FirebaseAuth/<GetAuth>c__AnonStorey1:<>m__0 () + 0x72 (0x1216b20d0 0x1216b2211) [0x13b406660 - Unity Child Domain]
#4  0x00000121664161 in  Firebase.FirebaseApp:TranslateDllNotFoundException (System.Action) + 0x51 (0x121664110 0x1216642c5) [0x13b406660 - Unity Child Domain]
#5  0x000001216b0b46 in  Firebase.Auth.FirebaseAuth:GetAuth (Firebase.FirebaseApp) + 0x4b6 (0x1216b0690 0x1216b1365) [0x13b406660 - Unity Child Domain]
#6  0x0000013e8beb04 in  Firebase.Unity.FirebaseAuthService:GetTokenAsync (Firebase.Platform.IFirebaseAppPlatform,bool) + 0x154 (0x13e8be9b0 0x13e8bebeb) [0x13b406660 - Unity Child Domain]
#7  0x0000013e8be864 in  Firebase.Platform.Default.BaseAuthService:GetTokenAsync (Firebase.Platform.IFirebaseAppPlatform,bool,Firebase.Platform.IGetTokenCompletionListener) + 0xd4 (0x13e8be790 0x13e8be917) [0x13b406660 - Unity Child Domain]
#8  0x0000013e8be505 in  Firebase.Database.Core.AuthTokenProvider:GetToken (bool,Firebase.Platform.IGetTokenCompletionListener) + 0x95 (0x13e8be470 0x13e8be529) [0x13b406660 - Unity Child Domain]
#9  0x0000013e8be39e in  Firebase.Database.Internal.Core.Context/ConnectionAuthTokenProvider258:GetToken (bool,Firebase.Database.Internal.Connection.ConnectionAuthTokenProvider/IGetTokenCallback) + 0xae (0x13e8be2f0 0x13e8be3c2) [0x13b406660 - Unity Child Domain]
#10 0x0000013e8be20d in  Firebase.Database.Internal.Connection.PersistentConnectionImpl/Runnable557:Run () + 0x28d (0x13e8bdf80 0x13e8be231) [0x13b406660 - Unity Child Domain]
#11 0x0000013e8bdf4d in  Firebase.Database.Internal.Connection.Util.RetryHelper/Runnable53:Run () + 0x7d (0x13e8bded0 0x13e8bdf71) [0x13b406660 - Unity Child Domain]
#12 0x0000013e8bdc1e in  Google.Sharpen.ScheduledThreadPoolExecutor/Task`1<object>:Run () + 0x16e (0x13e8bdab0 0x13e8bdda6) [0x13b406660 - Unity Child Domain]
#13 0x0000013e274a33 in  Google.Sharpen.ThreadPoolExecutor:RunPoolThread () + 0x2b3 (0x13e274780 0x13e274b50) [0x13b406660 - Unity Child Domain]
#14 0x0000013e27427d in  Google.Sharpen.RunnableAction:Run () + 0x4d (0x13e274230 0x13e2742a1) [0x13b406660 - Unity Child Domain]
#15 0x0000013e273f7a in  Firebase.Database.Internal.Utilities.DefaultRunLoop/FirebaseThreadFactory/ExceptionCatcher:Run () + 0x6a (0x13e273f10 0x13e274097) [0x13b406660 - Unity Child Domain]
#16 0x0000013e273bd8 in  Google.Sharpen.Thread:InternalRun () + 0x98 (0x13e273b40 0x13e273d67) [0x13b406660 - Unity Child Domain]
#17 0x000001209b6a2a in  (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) + 0xfa (0x1209b6930 0x1209b6b5d) [0x13b406660 - Unity Child Domain]
#18 0x0000013ac0a112 in mono_get_runtime_build_info
#19 0x0000013ad36a9a in mono_runtime_invoke
#20 0x0000013ad3b816 in mono_runtime_delegate_invoke
#21 0x0000013ad62780 in mono_thread_create_internal
#22 0x0000013ad92c46 in CreateThread
#23 0x0000013adb9122 in GC_start_routine
#24 0x007fff768ab33d in _pthread_body
#25 0x007fff768ae2a7 in _pthread_start
#26 0x007fff768aa425 in thread_start
Launching bug reporter
est"}}
DEBUG: Deleting app __FIRAPP_DEFAULT (0x03e23600)
DEBUG: Notifying 0x041b7c20 of 0x03e23600 deletion
DEBUG: Notified flag for 0x041b7c20 = true
DEBUG: Notified flag for 0x041b7c20 = false
DEBUG: Notifying 0x041b8c20 of 0x03e23600 deletion
DEBUG: Notified flag for 0x041b8c20 = true
DEBUG: Notified flag for 0x041b8c20 = false
DEBUG: Deleting Auth 0x6000041b8c20 for App 0x600003e23600
DEBUG: Disabling all app initializers
DEBUG: Disable analytics
DEBUG: Disable auth
DEBUG: Disable database
DEBUG: Disable dynamic_links
DEBUG: Disable functions
DEBUG: Disable instance_id
DEBUG: Disable invites
DEBUG: Disable messaging
DEBUG: Disable remote_config
DEBUG: Disable storage

It looks like it is some Unity maintenance task to reduce memory consumption which also tries to shut down Firebase which then causes the crash. The game is not running during that time.

We've also tried Unity 2018.2.13 with the same result.

stewartmiles commented 5 years ago

Closing as a duplicate of https://github.com/firebase/quickstart-unity/issues/200 and https://github.com/firebase/quickstart-unity/issues/191 @chkuang-g is working on this.