From 1e416e202bb97c7eeec736515392884f1d803e95 Mon Sep 17 00:00:00 2001 From: Dominion Date: Sun, 11 Jun 2023 10:16:27 -0400 Subject: [PATCH 1/3] Update Byond.TopicSender to 7.0.1 Also note this pushes Microsoft.Extensions.Logging.Abstractions to 7.0.0 This fixes instabilities in topic serialization. Probably fixes #1529 --- src/DMAPI/tgs/v5/_defines.dm | 4 ++-- .../Components/Interop/DMApiConstants.cs | 4 ++-- .../Tgstation.Server.Host.csproj | 4 +--- tests/DMAPI/LongRunning/Test.dm | 2 +- .../Live/Instance/WatchdogTest.cs | 14 +++----------- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/DMAPI/tgs/v5/_defines.dm b/src/DMAPI/tgs/v5/_defines.dm index a3f949081f..2f08cddd35 100644 --- a/src/DMAPI/tgs/v5/_defines.dm +++ b/src/DMAPI/tgs/v5/_defines.dm @@ -5,8 +5,8 @@ #define DMAPI5_TOPIC_DATA "tgs_data" #define DMAPI5_BRIDGE_REQUEST_LIMIT 8198 -#define DMAPI5_TOPIC_REQUEST_LIMIT 65529 -#define DMAPI5_TOPIC_RESPONSE_LIMIT 65528 +#define DMAPI5_TOPIC_REQUEST_LIMIT 65528 +#define DMAPI5_TOPIC_RESPONSE_LIMIT 65529 #define DMAPI5_BRIDGE_COMMAND_PORT_UPDATE 0 #define DMAPI5_BRIDGE_COMMAND_STARTUP 1 diff --git a/src/Tgstation.Server.Host/Components/Interop/DMApiConstants.cs b/src/Tgstation.Server.Host/Components/Interop/DMApiConstants.cs index 3a2c6fe9fb..9cca307361 100644 --- a/src/Tgstation.Server.Host/Components/Interop/DMApiConstants.cs +++ b/src/Tgstation.Server.Host/Components/Interop/DMApiConstants.cs @@ -42,12 +42,12 @@ namespace Tgstation.Server.Host.Components.Interop /// /// The maximum length in bytes of a payload. /// - public const uint MaximumTopicRequestLength = 65529; + public const uint MaximumTopicRequestLength = 65528; /// /// The maximum length in bytes of a response. /// - public const uint MaximumTopicResponseLength = 65528; + public const uint MaximumTopicResponseLength = 65529; /// /// The DMAPI being used. diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index cf25b7210b..6aa45b0e12 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -68,7 +68,7 @@ - + @@ -94,8 +94,6 @@ - - diff --git a/tests/DMAPI/LongRunning/Test.dm b/tests/DMAPI/LongRunning/Test.dm index de5cd5831d..b81b7f3f42 100644 --- a/tests/DMAPI/LongRunning/Test.dm +++ b/tests/DMAPI/LongRunning/Test.dm @@ -207,7 +207,7 @@ var/run_bridge_test /datum/tgs_chat_command/response_overload_test/Run(datum/tgs_chat_user/sender, params) // DMAPI5_TOPIC_RESPONSE_LIMIT - var/limit = 65528 + var/limit = 65529 // this actually gets doubled because it's in two fields for backwards compatibility, but that's fine var/datum/tgs_message_content/response = new(create_payload(limit * 3)) return response diff --git a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs index 1621b8fe7f..d560bcc9bf 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs @@ -550,7 +550,7 @@ namespace Tgstation.Server.Tests.Live.Instance try { System.Console.WriteLine($"Topic send limit test S:{currentSize}..."); - topicRequestResult = await TopicClientNoLogger.SendTopic( + topicRequestResult = await TopicClient.SendTopic( IPAddress.Loopback, $"tgs_integration_test_tactics3={TopicClient.SanitizeString(JsonConvert.SerializeObject(topic, DMApiConstants.SerializerSettings))}", TestLiveServer.DDPort, @@ -591,7 +591,7 @@ namespace Tgstation.Server.Tests.Live.Instance { var currentSize = baseSize + (int)Math.Pow(2, nextPow); System.Console.WriteLine($"Topic recieve limit test S:{currentSize}..."); - var topicRequestResult = await TopicClientNoLogger.SendTopic( + var topicRequestResult = await TopicClient.SendTopic( IPAddress.Loopback, $"tgs_integration_test_tactics4={TopicClient.SanitizeString(currentSize.ToString())}", TestLiveServer.DDPort, @@ -944,15 +944,7 @@ namespace Tgstation.Server.Tests.Live.Instance ReceiveTimeout = TimeSpan.FromSeconds(30), ConnectTimeout = TimeSpan.FromSeconds(30), DisconnectTimeout = TimeSpan.FromSeconds(30) - }, new Logger(LiveTestUtils.CreateLoggerFactoryForLogger(loggerFactory.CreateLogger("WatchdogTest.TopicClient"), out var mockLoggerFactory))); - - public static readonly TopicClient TopicClientNoLogger = new(new SocketParameters - { - SendTimeout = TimeSpan.FromSeconds(30), - ReceiveTimeout = TimeSpan.FromSeconds(30), - ConnectTimeout = TimeSpan.FromSeconds(30), - DisconnectTimeout = TimeSpan.FromSeconds(30) - }); + }, loggerFactory.CreateLogger("WatchdogTest.TopicClient")); public async Task TellWorldToReboot(CancellationToken cancellationToken) { From 7e0d4a29b845357b4899df7c781940326bfe239c Mon Sep 17 00:00:00 2001 From: Dominion Date: Sun, 11 Jun 2023 10:39:29 -0400 Subject: [PATCH 2/3] Add concurrency group to auto approve workflow --- .github/workflows/auto-approve-dominions-prs.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/auto-approve-dominions-prs.yml b/.github/workflows/auto-approve-dominions-prs.yml index 4062b6c5f0..dc38f8117a 100644 --- a/.github/workflows/auto-approve-dominions-prs.yml +++ b/.github/workflows/auto-approve-dominions-prs.yml @@ -9,6 +9,10 @@ on: - dev - master +concurrency: + group: "auto-approve-${{ github.head_ref || github.run_id }}-${{ github.event_name }}" + cancel-in-progress: true + jobs: approve-pr-if-dominion-is-author: name: Approve PR if Dominion is Author From 8950cc1a3684e0df64aebe5a67b2debc01f6ef7e Mon Sep 17 00:00:00 2001 From: Dominion Date: Mon, 5 Jun 2023 17:14:11 -0400 Subject: [PATCH 3/3] Catch potential IOExceptions when listing a config directory --- .../Components/StaticFiles/Configuration.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs index 55a8aba459..5e7391a6fc 100644 --- a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs +++ b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs @@ -227,28 +227,28 @@ namespace Tgstation.Server.Host.Components.StaticFiles void ListImpl() { - var enumerator = synchronousIOManager.GetDirectories(path, cancellationToken); try { + var enumerator = synchronousIOManager.GetDirectories(path, cancellationToken); result.AddRange(enumerator.Select(x => new ConfigurationFileResponse { IsDirectory = true, Path = ioManager.ConcatPath(configurationRelativePath, x), }).OrderBy(file => file.Path)); + + enumerator = synchronousIOManager.GetFiles(path, cancellationToken); + result.AddRange(enumerator.Select(x => new ConfigurationFileResponse + { + IsDirectory = false, + Path = ioManager.ConcatPath(configurationRelativePath, x), + }).OrderBy(file => file.Path)); } - catch (IOException e) + catch (IOException ex) { - logger.LogDebug(e, "IOException while writing {path}!", path); + logger.LogDebug(ex, "IOException while enumerating direcotry!"); result = null; return; } - - enumerator = synchronousIOManager.GetFiles(path, cancellationToken); - result.AddRange(enumerator.Select(x => new ConfigurationFileResponse - { - IsDirectory = false, - Path = ioManager.ConcatPath(configurationRelativePath, x), - }).OrderBy(file => file.Path)); } using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken))