From 8fc374ea3dfae2b4552eed77eb46afd3942a0cd1 Mon Sep 17 00:00:00 2001 From: Michael Mayr Date: Mon, 18 Feb 2019 14:24:17 +0100 Subject: [PATCH 1/6] ONE-22295: set max request content length to 16GB --- src/SuperDumpService/web.config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/SuperDumpService/web.config b/src/SuperDumpService/web.config index b5f9731..5fd3474 100644 --- a/src/SuperDumpService/web.config +++ b/src/SuperDumpService/web.config @@ -13,5 +13,11 @@ + + + + + + \ No newline at end of file From d1e01f7951a2482baaefb3b9281046a12fe92b36 Mon Sep 17 00:00:00 2001 From: Michael Mayr Date: Mon, 18 Feb 2019 14:26:35 +0100 Subject: [PATCH 2/6] fixed typo --- src/SuperDumpService/web.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SuperDumpService/web.config b/src/SuperDumpService/web.config index 5fd3474..33dec9e 100644 --- a/src/SuperDumpService/web.config +++ b/src/SuperDumpService/web.config @@ -15,7 +15,7 @@ - + From dff847d532aba98e3cfb4bb383bf55d05a23e19a Mon Sep 17 00:00:00 2001 From: Michael Mayr Date: Mon, 18 Feb 2019 14:33:51 +0100 Subject: [PATCH 3/6] ONE-22295: adjust max request content length to 4GB - 1 --- src/SuperDumpService/web.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SuperDumpService/web.config b/src/SuperDumpService/web.config index 33dec9e..98ad5ee 100644 --- a/src/SuperDumpService/web.config +++ b/src/SuperDumpService/web.config @@ -15,8 +15,8 @@ - - + + From af53a01fa16c8c0a73208417afbe9f3846cbb34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Neum=C3=BCller?= Date: Tue, 15 Jan 2019 09:35:38 +0100 Subject: [PATCH 4/6] jira authentication fix --- .../Services/JiraApiService.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/SuperDumpService/Services/JiraApiService.cs b/src/SuperDumpService/Services/JiraApiService.cs index f01a415..0546a98 100644 --- a/src/SuperDumpService/Services/JiraApiService.cs +++ b/src/SuperDumpService/Services/JiraApiService.cs @@ -7,6 +7,7 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Web; using Microsoft.Extensions.Options; @@ -38,6 +39,7 @@ public class JiraApiService : IJiraApiService { private const string JsonMediaType = "application/json"; private const string JiraIssueFields = "status,resolution"; private readonly string[] JiraIssueFieldsArray = JiraIssueFields.Split(","); + private readonly SemaphoreSlim authSync = new SemaphoreSlim(1, 1); private readonly JiraIntegrationSettings settings; private readonly HttpClient client; @@ -81,12 +83,23 @@ private async Task Authenticate() { } private async Task EnsureAuthentication() { - // reauthenticate every 10 minutes - if (Session == null || (DateTime.Now - Session.loginInfo.previousLoginTime).Minutes > 10) { - await Authenticate(); + if (ShallAuthenticate()) { + await authSync.WaitAsync().ConfigureAwait(false); + try { + if (ShallAuthenticate()) { + await Authenticate(); + } + } finally { + authSync.Release(); + } } } + private bool ShallAuthenticate() { + // reauthenticate every 10 minutes + return Session == null || (DateTime.Now - Session.loginInfo.previousLoginTime).Minutes > 10; + } + public async Task> GetJiraIssues(string bundleId) { return await JiraSearch($"text ~ {bundleId}"); } From e928a7c63b038f6baa9d27b8836b8fea8f8f3d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Neum=C3=BCller?= Date: Tue, 18 Dec 2018 07:45:46 +0100 Subject: [PATCH 5/6] StartSession API change --- src/SuperDumpService/Webterm/WebTermHandler.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/SuperDumpService/Webterm/WebTermHandler.cs b/src/SuperDumpService/Webterm/WebTermHandler.cs index 329104b..f9c6e60 100644 --- a/src/SuperDumpService/Webterm/WebTermHandler.cs +++ b/src/SuperDumpService/Webterm/WebTermHandler.cs @@ -77,10 +77,7 @@ public void ReceiveMessage(string socketId, string input) { // called by WebSocketManager public void StartSession(string socketId, string bundleId, string dumpId, string initialCommand) { - StartSession0(socketId, DumpIdentifier.Create(bundleId, dumpId), initialCommand); - } - - public void StartSession0(string socketId, DumpIdentifier id, string initialCommand) { + var id = DumpIdentifier.Create(bundleId, dumpId); try { System.Console.WriteLine($"StartSession ({socketId}): {id}"); if (string.IsNullOrEmpty(id.BundleId) || string.IsNullOrEmpty(id.DumpId)) { From 8dab9780b5083dbe4452a2e12fd1b66bbcba8f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Neum=C3=BCller?= Date: Tue, 18 Dec 2018 07:46:27 +0100 Subject: [PATCH 6/6] revert parallelizm of similarity calculation loop --- src/SuperDumpService/Services/SimilarityService.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/SuperDumpService/Services/SimilarityService.cs b/src/SuperDumpService/Services/SimilarityService.cs index adf8867..431b3f6 100644 --- a/src/SuperDumpService/Services/SimilarityService.cs +++ b/src/SuperDumpService/Services/SimilarityService.cs @@ -138,20 +138,20 @@ public async Task CalculateSimilarityAsync(DumpMetainfo dumpA, bool force, DateT var allDumps = dumpRepo.GetAll().Where(x => x.Created >= timeFrom).OrderBy(x => x.Created); Console.WriteLine($"starting CalculateSimilarity for {allDumps.Count()} dumps; {dumpA} (TID:{Thread.CurrentThread.ManagedThreadId})"); - var tasks = allDumps.Select(dumpB => Task.Run(async () => { + foreach(var dumpB in allDumps) { if (!force) { var existingSimilarity = await relationShipRepo.GetRelationShip(dumpA.Id, dumpB.Id); if (existingSimilarity != 0) { // relationship already exists. skip! // but make sure the relationship is stored bi-directional await relationShipRepo.UpdateSimilarity(dumpA.Id, dumpB.Id, existingSimilarity); - return; + continue; } } - if (!PreSelectOnMetadata(dumpA, dumpB)) return; + if (!PreSelectOnMetadata(dumpA, dumpB)) continue; var resultB = await GetOrCreateMiniInfo(dumpB.Id); - if (!PreSelectOnResults(resultA, resultB)) return; + if (!PreSelectOnResults(resultA, resultB)) continue; CrashSimilarity crashSimilarity = CrashSimilarity.Calculate(resultA, resultB); @@ -160,8 +160,7 @@ public async Task CalculateSimilarityAsync(DumpMetainfo dumpA, bool force, DateT await relationShipRepo.UpdateSimilarity(dumpA.Id, dumpB.Id, crashSimilarity.OverallSimilarity); } //Console.WriteLine($"CalculateSimilarity.Finished for {dumpA}/{dumpB} ({i} to go...); (elapsed: {sw.Elapsed}) (TID:{Thread.CurrentThread.ManagedThreadId})"); - })); - await Task.WhenAll(tasks); + } await relationShipRepo.FlushDirtyRelationships(); swTotal.Stop();