Skip to content

Conversation

simon-lemay-unity
Copy link
Contributor

@simon-lemay-unity simon-lemay-unity commented Apr 4, 2025

This avoids the error message reported in MTTB-1143.

The UnityTransport.Send method would happily accept invalid or stale connections, which would lead to the allocation of a BatchedSendQueue structure and to an error message when the batched sends are passed on to the driver.

In MTTB-1143 we'd get a send on client ID 0, but that's not a valid client ID in UnityTransport. My guess is that there's something somewhere (possibly in Boss Room) triggering a send to the server after the connection has closed (which reverts UnityTransport.ServerClientId to its default value of 0). Of course, ideally there'd never be such a send-after-disconnect and that's what should be ultimately addressed. But the bug is quite hard to reproduce, so as a stopgap until we have something better I'm making a fix that only avoids the last and more user-visible consequences of the issue.

Changelog

  • Fixed: Fixed an issue in UnityTransport where the transport would accept sends on invalid connections, leading to a useless memory allocation and confusing error message.

Testing and Documentation

  • No tests have been added.
  • No documentation changes or additions were necessary.

@simon-lemay-unity simon-lemay-unity requested a review from a team as a code owner April 4, 2025 19:24
@michalChrobot
Copy link
Collaborator

I wonder if we shouldn't add a test for this case? And also question if this should be also ported to develop branch (NGOv1.X)

@simon-lemay-unity
Copy link
Contributor Author

I'll add a test case and backport the changes to 1.X.

@simon-lemay-unity simon-lemay-unity enabled auto-merge (squash) April 8, 2025 16:18
@simon-lemay-unity simon-lemay-unity merged commit 78cad42 into develop-2.0.0 Apr 8, 2025
27 checks passed
@simon-lemay-unity simon-lemay-unity deleted the fix/unity-transport-invalid-connections branch April 8, 2025 19:08
@michalChrobot michalChrobot added the port:1.x-needed This issue needs to be ported to 1.X branch label Apr 9, 2025
simon-lemay-unity added a commit that referenced this pull request Apr 9, 2025
…3383)

Backport of PR #3382.

## Changelog

- Fixed: Fixed an issue in `UnityTransport` where the transport would
accept sends on invalid connections, leading to a useless memory
allocation and confusing error message.

## Testing and Documentation

- Includes integration test.
- No documentation changes or additions were necessary.

---------

Co-authored-by: michalChrobot <[email protected]>
Co-authored-by: Michał Chrobot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

port:1.x-needed This issue needs to be ported to 1.X branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants