Skip to content

fix: Shut down NetworkManager when reloading the domain#4068

Open
simon-lemay-unity wants to merge 2 commits into
develop-2.0.0from
fix/shutdown-on-domain-reload
Open

fix: Shut down NetworkManager when reloading the domain#4068
simon-lemay-unity wants to merge 2 commits into
develop-2.0.0from
fix/shutdown-on-domain-reload

Conversation

@simon-lemay-unity

Copy link
Copy Markdown
Contributor

Purpose of this PR

When the domain is reloaded while in play mode, a lot (most?) of the state in NetworkManager is lost because it's not serializable. This state gets lost without any opportunity to properly clean it up which results in memory leaks and sockets not being closed. (The last one is particularly problematic because the zombie sockets will cause issues as long as the editor is open.)

While ideally NGO would serialize all of its state and survive domain reloads, that's probably not very realistic in the short term as that would require extensive changes to the code. What we can do relatively easily however is properly shut down the NetworkManager when we do detect a domain reload. This at least avoids leaking resources.

Jira ticket

UUM-146443

Changelog

  • Fixed: NetworkManager will now perform a proper shutdown when the domain is reloaded in play mode, instead of being left in some half-initialized state that leaks memory and socket handles.

Documentation

  • No documentation changes or additions were necessary.

Testing & QA

Functional Testing

Manual testing :

  • Manual testing done

Automated tests:

  • Covered by existing automated tests
  • Covered by new automated tests

Does the change require QA team to:

  • Review automated tests?
  • Execute manual tests?
  • Provide feedback about the PR?

Backports

Probably not worth it.

@simon-lemay-unity simon-lemay-unity requested a review from a team as a code owner July 6, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant