From 72f4cbe0a5fe9311e22b57027a1b26e02f3befca Mon Sep 17 00:00:00 2001 From: Alberto Balbo Date: Sun, 15 Nov 2026 12:13:47 +0100 Subject: [PATCH] TEMPORARY: run the PostgreSQL suite three times on one server, push only (refs #98) Two clean runs did not show the restart. This collects the server log of a failure sooner and lists Docker's events for the service container (oom, kill, die). Reverted before the merge. Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/ci.yml | 10 ++++++++-- tools/Anubis.Tasks/ServiceLog.cs | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 42c74c1..cb0abb4 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -9,13 +9,14 @@ on: jobs: test: + if: github.event_name == 'push' # TEMPORARY (issue #98): stress run, three suites on one server runs-on: ubuntu-latest container: image: mcr.microsoft.com/dotnet/sdk:10.0 strategy: fail-fast: false matrix: - db: [sqlite, postgres] + db: [postgres] # TEMPORARY (issue #98) services: postgres: image: postgres:18 @@ -44,13 +45,18 @@ jobs: git -c http.extraHeader="Authorization: token ${{ github.token }}" fetch -q --depth 1 origin "${{ github.sha }}" git checkout -q FETCH_HEAD - name: Check - run: sh ./tasks.sh check + # TEMPORARY (issue #98): the PostgreSQL suite three times on the same server. + run: | + status=0 + for i in 1 2 3; do echo "== round $i"; sh ./tasks.sh test -c Release || status=1; done + exit $status # The log of the PostgreSQL service, read through the Docker socket the runner mounts in the job (issue #98). - name: PostgreSQL log if: always() && matrix.db == 'postgres' run: sh ./tasks.sh ci-service-log postgres image: + if: false # TEMPORARY (issue #98) needs: test runs-on: ubuntu-latest # Registry settings for phase 9 (issue #70): declared here, not used before then. diff --git a/tools/Anubis.Tasks/ServiceLog.cs b/tools/Anubis.Tasks/ServiceLog.cs index e672490..17ddff3 100644 --- a/tools/Anubis.Tasks/ServiceLog.cs +++ b/tools/Anubis.Tasks/ServiceLog.cs @@ -83,6 +83,24 @@ internal static class ServiceLog Console.WriteLine($"Memoria ora: {Mib(memory?["usage"])}, limite visto dal contenitore {Mib(memory?["limit"])}, massimo {Mib(memory?["max_usage"])}"); } + // Out-of-memory kills and signals as Docker saw them, from the container's start until now. + var since = DateTimeOffset.Parse(state?["StartedAt"]?.GetValue() ?? "", CultureInfo.InvariantCulture).ToUnixTimeSeconds(); + var until = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); + var events = Uri.EscapeDataString($$"""{"container":["{{id}}"]}"""); + using (var answer = http.GetAsync(new Uri($"events?since={since}&until={until}&filters={events}", UriKind.Relative)).GetAwaiter().GetResult()) + { + answer.EnsureSuccessStatusCode(); + var lines = answer.Content.ReadAsStringAsync().GetAwaiter().GetResult() + .Split('\n', StringSplitOptions.RemoveEmptyEntries) + .Select(line => JsonNode.Parse(line)) + .Where(e => e?["Action"]?.GetValue() is not { } action + || !(action.StartsWith("exec_", StringComparison.Ordinal) || action == "health_status: healthy")) + .Select(e => $" {DateTimeOffset.FromUnixTimeSeconds(e?["time"]?.GetValue() ?? 0):O} {e?["Action"]}") + .ToList(); + Console.WriteLine($"Eventi di Docker: {(lines.Count == 0 ? "nessuno" : "")}"); + lines.ForEach(Console.WriteLine); + } + Console.WriteLine("-- registro"); using var response = http.GetAsync(new Uri($"containers/{id}/logs?stdout=1&stderr=1×tamps=1", UriKind.Relative)).GetAwaiter().GetResult(); response.EnsureSuccessStatusCode();