Skip to content

Commit 33bb5c1

Browse files
SamuelBellomomichalChrobotNoelStephensUnity
authored
chore: Release merge back 1.14.0 (#3570)
<!-- Replace this block with what this PR does and why. Describe what you'd like reviewers to know, how you applied the engineering principles, and any interesting tradeoffs made. Delete bullet points below that don't apply, and update the changelog section as appropriate. --> update with latest package and changelog version + merge back fixes needed for the release <!-- Add short version of the JIRA ticket to the PR title (e.g. "feat: new shiny feature [MTT-123]") --> <!-- Uncomment and mark items off with a * if this PR deprecates any API: ### Deprecated API - [ ] An `[Obsolete]` attribute was added along with a `(RemovedAfter yyyy-mm-dd)` entry. - [ ] An [api updater] was added. - [ ] Deprecation of the API is explained in the CHANGELOG. - [ ] The users can understand why this API was removed and what they should use instead. --> ## Backport Not needed <!-- If this is a backport: - Add the following to the PR title: "\[Backport\] ..." . - Link to the original PR. If this needs a backport - state this here If a backport is not needed please provide the reason why. If the "Backports" section is not present it will lead to a CI test failure. --> --------- Co-authored-by: michalChrobot <[email protected]> Co-authored-by: Noel Stephens <[email protected]> Co-authored-by: Michał Chrobot <[email protected]>
1 parent bb9dbf1 commit 33bb5c1

File tree

12 files changed

+745
-136
lines changed

12 files changed

+745
-136
lines changed

.yamato/wrench/recipe-regeneration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ test_-_wrench_jobs_up_to_date:
99
type: Unity::VM
1010
flavor: b1.large
1111
commands:
12-
- command: dotnet run --project Tools\CI\NGO.Cookbook.csproj
12+
- command: dotnet run --project Tools/CI/NGO.Cookbook.csproj
1313
- command: |-
1414
if [ -n "$(git status --porcelain -- .yamato/wrench)" ]; then
1515
git status
1616
echo "Your repo is not clean - diff output:"
1717
git diff
1818
echo "You must run recipe generation after updating recipes to update the generated YAML!"
19-
echo "Run 'dotnet run --project Tools\CI\NGO.Cookbook.csproj' from the root of your repository to regenerate all job definitions created by wrench."
19+
echo "Run 'dotnet run --project Tools/CI/NGO.Cookbook.csproj' from the root of your repository to regenerate all job definitions created by wrench."
2020
exit 1
2121
fi
2222
variables:

.yamato/wrench/validation-jobs.yml

Lines changed: 36 additions & 36 deletions
Large diffs are not rendered by default.

.yamato/wrench/wrench_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
"branch_pattern": "ReleaseSlash",
3434
"wrench_version": "0.12.2.0",
3535
"pvp_exemption_path": ".yamato/wrench/pvp-exemptions.json",
36-
"cs_project_path": "Tools\\CI\\NGO.Cookbook.csproj"
36+
"cs_project_path": "Tools/CI/NGO.Cookbook.csproj"
3737
}

Tools/CI/Settings/NGOSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class NGOSettings : AnnotatedSettingsBase
1212
static ValidationOptions validationOptions = new ValidationOptions()
1313
{
1414
ProjectPath = "testproject",
15-
UtrTestingYamatoTimeout = 40
15+
UtrTestingYamatoTimeout = 180 // 3h This it to address the issue that we are running both package and project test and that their execution is much slower on editors below 6000
1616
};
1717

1818
// update this to list all packages in this repo that you want to release.

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ Additional documentation and release notes are available at [Multiplayer Documen
1010

1111
### Added
1212

13+
### Added
14+
1315
### Fixed
1416

1517
- Fixed issue where NetworkConfig.ConnectionData could cause the ConnectionRequestMessage to exceed the transport's MTU size and would result in a buffer overflow error. (#3565)
1618

1719
### Changed
1820

21+
1922
## [1.14.0] - 2025-07-21
2023

2124
### Added

com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageCorruptionTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ public unsafe void Send(ulong clientId, NetworkDelivery delivery, FastBufferWrit
9595
for (int i = 0; i < 4; i++)
9696
{
9797
var currentByte = batchData.GetUnsafePtr()[i];
98-
batchData.WriteByteSafe((byte)(currentByte == 0 ? 1 : 0));
98+
currentByte = (byte)((currentByte + 1) % 255);
99+
batchData.WriteByteSafe(currentByte);
99100
MessageQueue.Add(batchData.ToArray());
100101
}
101102
break;

com.unity.netcode.gameobjects/Tests/Runtime/ConnectionApprovalTimeoutTests.cs

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,28 @@ protected override void OnServerAndClientsCreated()
5555
base.OnServerAndClientsCreated();
5656
}
5757

58+
private MessageCatcher<ConnectionRequestMessage> m_ConnectionRequestCatcher;
59+
private MessageCatcher<ConnectionApprovedMessage> m_ConnectionApprovedCatcher;
5860
protected override IEnumerator OnStartedServerAndClients()
5961
{
62+
m_ClientStopped = false;
63+
m_ServerStopped = false;
64+
m_ClientNetworkManagers[0].OnClientStopped += OnClientStopped;
65+
m_ServerNetworkManager.OnServerStopped += OnServerStopped;
6066
if (m_ApprovalFailureType == ApprovalTimedOutTypes.ServerDoesNotRespond)
6167
{
6268
// We catch (don't process) the incoming approval message to simulate the server not sending the approved message in time
63-
m_ClientNetworkManagers[0].ConnectionManager.MessageManager.Hook(new MessageCatcher<ConnectionApprovedMessage>(m_ClientNetworkManagers[0]));
69+
m_ConnectionApprovedCatcher = new MessageCatcher<ConnectionApprovedMessage>(m_ClientNetworkManagers[0], m_EnableVerboseDebug);
70+
m_ClientNetworkManagers[0].ConnectionManager.MessageManager.Hook(m_ConnectionApprovedCatcher);
6471
m_ExpectedLogMessage = new Regex("Timed out waiting for the server to approve the connection request.");
6572
m_LogType = LogType.Log;
6673
}
6774
else
6875
{
6976
// We catch (don't process) the incoming connection request message to simulate a transport connection but the client never
7077
// sends (or takes too long to send) the connection request.
71-
m_ServerNetworkManager.ConnectionManager.MessageManager.Hook(new MessageCatcher<ConnectionRequestMessage>(m_ServerNetworkManager));
78+
m_ConnectionRequestCatcher = new MessageCatcher<ConnectionRequestMessage>(m_ServerNetworkManager, m_EnableVerboseDebug);
79+
m_ServerNetworkManager.ConnectionManager.MessageManager.Hook(m_ConnectionRequestCatcher);
7280

7381
// For this test, we know the timed out client will be Client-1
7482
m_ExpectedLogMessage = new Regex("Server detected a transport connection from Client-1, but timed out waiting for the connection request message.");
@@ -98,6 +106,43 @@ public IEnumerator ValidateApprovalTimeout()
98106

99107
Assert.AreEqual(0, m_ServerNetworkManager.ConnectionManager.PendingClients.Count, $"Expected no pending clients when there were {m_ServerNetworkManager.ConnectionManager.PendingClients.Count} pending clients!");
100108
Assert.True(!m_ClientNetworkManagers[0].LocalClient.IsApproved, $"Expected the client to not have been approved, but it was!");
109+
110+
if (m_ApprovalFailureType == ApprovalTimedOutTypes.ServerDoesNotRespond)
111+
{
112+
m_ConnectionApprovedCatcher.ClearMessages();
113+
}
114+
else
115+
{
116+
m_ConnectionRequestCatcher.ClearMessages();
117+
}
118+
119+
if (!m_ClientStopped)
120+
{
121+
m_ClientNetworkManagers[0].Shutdown();
122+
}
123+
124+
if (!m_ServerStopped)
125+
{
126+
m_ServerNetworkManager.Shutdown();
127+
}
128+
129+
yield return WaitForConditionOrTimeOut(() => m_ClientStopped && m_ServerStopped);
130+
AssertOnTimeout($"Timed out waiting for the client or server to stop!");
131+
}
132+
133+
private bool m_ClientStopped;
134+
private void OnClientStopped(bool obj)
135+
{
136+
m_ClientNetworkManagers[0].OnClientStopped -= OnClientStopped;
137+
m_ClientStopped = true;
101138
}
139+
140+
private bool m_ServerStopped;
141+
private void OnServerStopped(bool obj)
142+
{
143+
m_ServerNetworkManager.OnServerStopped -= OnServerStopped;
144+
m_ServerStopped = true;
145+
}
146+
102147
}
103148
}

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/MessageCatcher.cs

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
using System;
22
using System.Collections.Generic;
33
using Unity.Collections;
4+
using UnityEngine;
45

56
namespace Unity.Netcode.RuntimeTests
67
{
78
internal class MessageCatcher<TMessageType> : INetworkHooks where TMessageType : INetworkMessage
89
{
910
private NetworkManager m_OwnerNetworkManager;
1011

11-
public MessageCatcher(NetworkManager ownerNetworkManager)
12+
private bool m_VerboseDebug;
13+
14+
public MessageCatcher(NetworkManager ownerNetworkManager, bool verboseDebug = false)
1215
{
1316
m_OwnerNetworkManager = ownerNetworkManager;
1417
}
@@ -23,9 +26,38 @@ private struct TriggerData
2326
}
2427
private readonly List<TriggerData> m_CaughtMessages = new List<TriggerData>();
2528

26-
public void ReleaseMessages()
29+
30+
private void Log(string message)
2731
{
32+
if (!m_VerboseDebug)
33+
{
34+
return;
35+
}
2836

37+
Debug.Log($"[Client-{m_OwnerNetworkManager.LocalClientId}] {message}");
38+
}
39+
40+
internal void ClearMessages()
41+
{
42+
if (m_CaughtMessages.Count == 0)
43+
{
44+
return;
45+
}
46+
Log($"Clearing messages.");
47+
foreach (var caughtSpawn in m_CaughtMessages)
48+
{
49+
if (caughtSpawn.Reader.IsInitialized)
50+
{
51+
Log($"Disposing reader (size: {caughtSpawn.Reader.Length}).");
52+
caughtSpawn.Reader.Dispose();
53+
}
54+
}
55+
56+
m_CaughtMessages.Clear();
57+
}
58+
59+
public void ReleaseMessages()
60+
{
2961
foreach (var caughtSpawn in m_CaughtMessages)
3062
{
3163
// Reader will be disposed within HandleMessage

com.unity.netcode.gameobjects/Tests/Runtime/Transports/UnityTransportTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public IEnumerator Cleanup()
4343

4444
// Need to destroy the GameObject (all assigned components will get destroyed too)
4545
UnityEngine.Object.DestroyImmediate(m_Server.gameObject);
46+
m_Server = null;
4647
}
4748

4849
if (m_Client1)
@@ -51,6 +52,7 @@ public IEnumerator Cleanup()
5152

5253
// Need to destroy the GameObject (all assigned components will get destroyed too)
5354
UnityEngine.Object.DestroyImmediate(m_Client1.gameObject);
55+
m_Client1 = null;
5456
}
5557

5658
if (m_Client2)
@@ -59,6 +61,7 @@ public IEnumerator Cleanup()
5961

6062
// Need to destroy the GameObject (all assigned components will get destroyed too)
6163
UnityEngine.Object.DestroyImmediate(m_Client2.gameObject);
64+
m_Client2 = null;
6265
}
6366

6467
m_ServerEvents?.Clear();
@@ -315,7 +318,7 @@ public IEnumerator DisconnectOnReliableSendQueueOverflow()
315318
m_Server.StartServer();
316319
m_Client1.StartClient();
317320

318-
yield return WaitForNetworkEvent(NetworkEvent.Connect, m_Client1Events);
321+
yield return WaitForNetworkEvent(NetworkEvent.Connect, m_Client1Events, 5.0f);
319322

320323
m_Server.Shutdown();
321324

0 commit comments

Comments
 (0)