Unity Editor got hang after clicking play

Let me explain my scenario first. Recently, due to some known issues, my team decided to upgrade our unity firebase SDK to 6.7. The former one was 6.0. However, we found that on Firebase SDK 6.7, it wouldn’t support editor sign in with P12 key anymore. Hence, we turned to use the same signIn method as android. At first, it works fine. But we found that after playing for an hour in editor mode, when you restart the play mode(press to leave ‘play’ and press to start ‘play’), the editor gets hang forever. I have created a dump and had a basic analysis on it. However, I could not go any further. So I came here for help.

Here is my analysis:

  • I try to know which thread got stuck so long. I use windbg to get the lasting time of each threads.

  • After that, I try to see the call stack of thread 4a74, which is like below.

  • I found that it hangs because unity wants to unloadDomain. Hence, I start to check the mono open source to see what had happened.

  • It seems like that mono_domain_try_unload would fork a thread to call unload_thread_main, which I also found the thread in my dump(I can’t put any more picture due to limitation). Then I check what does that thread do. It seems like it would like to finalize monoDomain. However, it just waits there forever.

Here are some bizarre things about my findings.

  • I found that unload_thread_main only last for less than 1 seconds in my dump. It is not like what I expected.

  • The issue only happened after I upgraded my firebase SDK to 6.7 and I have tested with SDK 6.0. It works fine.

  • As mentioned above, I need to play in editor for about an hour. I think this may have some relation with FIrebase id token refresh

Here are my questions.

  • What is monoDomain?
  • Why gc monoDomain causes my editor hang?
  • Is this relative to firebase SDK?
  • If so, is that because unity could not garbage collect firebase SDK?
  • What should I do now…

I post this question here because my threads got hanged on unity call stack. Hope it is the right place to ask the question. BTW, I have tested Unity with 2018.4.4f and 2018.4.13f.

Thanks in advance.

Hi! You can read some about domain reloading here DomainReloading
I have a same issue with editor that’s hang on play button. After researching and decompiling Firebase.Editor.dll, I was find out what it uses [InitializeOnLoad] on some classes and every time when you push play button executes heavy code for ios, android platform dependencies resolving.
You can just try temporarily remove this dll - and see the project will run faster!
Try to contact with firebase team, open issue, etc…