Editor freezes on "Reloading domain". Please help !!!

My project is on halt for days because of Unity editor freezing on "Reloading domain". I am doing firebase authentication, messaging, remote config and push notifications. If I don't call any firebase API other than the one for initialization, things are fine.

I am using Unity 2022.3.8f1 and JetBrains Rider (updated to the latest version) as my code editor.

After running play-mode once, if I make any code changes, editor freezes on "Reloading domain". Sometimes without any code changes, even starting the debugger can trigger the same behaviour. Tried Visual studio community, VS Code also. Same results. Tried on both Windows and OSX too.

I am loosing my mind over this. I have a short window till deadline for the project. Tried almost everything I can find on forums. Any help will be highly appreciated !!! Thank you !

Attached below is a screen shot of the stack trace of Unity main thread when the freeze happens:

You've already narrowed it down a lot. It's hard to tell what might be happening without any code though.

My best guess is, since that is a web service it will have some form of background processing eg async/await and perhaps any of the callbacks run some Unity code that isn't threadsafe. Or due to domain reload, the unexpected happens and you have a lingering object waiting to receive a callback but when it does, it's state is no longer valid eg the object it waits for (semaphore) will never release and the wait becomes indefinite.

I would add logging to all firebase callbacks. And double check the event handlers, are they all properly unregistered in every circumstance including a domain reload?

You were right. Unregistered callback was the culprit. Thank you !

1 Like