Hi,

On 2022-03-04 22:01:22 -0800, Andres Freund wrote:
> On 2022-03-04 20:06:43 -0800, Andres Freund wrote:
> > On 2022-03-05 16:39:21 +1300, Thomas Munro wrote:
> > > I vote for committing that workaround into the tree temporarily,
> > > because it's not just cfbot, it's also everyone's dev branches on
> > > Github + the official mirror that are red.
> >
> > I'll do so after making dinner, unless you want to do so sooner. It did fix
> > the problem (intermixed with a few irrelevant changes): 
> > https://cirrus-ci.com/task/4928987829895168
>
> Pushed.

Cirrus now provides a way to get the old behaviour back without pinning an old
agent version. See attached and a run passing the problematic steps [1]:

The way this is intended to be done in cirrus (rather than preventing it from
killing "escaped" processes) would be to use 'background_script' to run
something longer running.

Unfortunately that's surprisingly hard with our tooling, or maybe I'm just
daft:

1) We don't have a way to wait for server startup to finish if we don't block
   on pg_ctl start. So we'd have to use 'sleep', write a loop around
   pq_isready. Perhaps pg_ctl should have an option to wait for server startup
   / shutdown without doing the starting/stopping itself?

2) There's no trivial way of starting postgres with pg_ctl and then waiting
   for the server to be shut down in the background script. The easiest would
   be to start psql just wait for it to be killed by an immediate shutdown :/.

3) We can't just start postgres in the foreground to get around 2), because
   pg_ctl does the dropping of permissions we need, rather than postgres
   itself. It'd also need 1).

Seems like we're missing some fairly basic tooling somehow...

Regards,

Andres

[1] https://cirrus-ci.com/task/5810196135018496
>From 5f3ea473977fb4242cc63073bb7ada32ced93242 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Sat, 19 Mar 2022 10:47:41 -0700
Subject: [PATCH v1] ci: windows: Use CIRRUS_ESCAPING_PROCESSES, revert
 770011e3f39.

cirrus-ci now defaults to killing processes still running at the end of a
script. Unfortunately we start postgres in the background, which seems
nontrivial to fix. Previously we worked around that in 770011e3f39 by using an
older agent version, but now that CIRRUS_ESCAPING_PROCESSES we should use that.

This reverts commit 770011e3f39f21f2095d3a044b72460c4efac345 "ci: windows:
Work around cirrus-ci bug causing test failures.

Discussion: https://postgr.es/m/ca+hukgkx7k14n2naalsvv6m_ab6ohasnba65x6dvo8hwfi9...@mail.gmail.com
---
 .cirrus.yml | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 6929a0d65aa..e5335fede76 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -375,11 +375,12 @@ task:
     # "suites".
     T_C: "\"C:/Program Files/Git/usr/bin/timeout.exe\" -v -k60s 15m"
 
-    # Temporarily work around cirrus-ci bug causing processes started from a
-    # script to be killed, even if intentionally running in background. See
-    # https://github.com/cirruslabs/cirrus-ci-agent/issues/218
-    # https://postgr.es/m/CA%2BhUKGKx7k14n2nAALSvv6M_AB6oHasNBA65X6Dvo8hwfi9y0A%40mail.gmail.com
-    CIRRUS_AGENT_VERSION: 1.73.2
+    # startcreate_script starts a postgres instance that we don't want to get
+    # killed at the end of that script (it's stopped in stop_script). Can't
+    # trivially use background_scripts because a) need pg_ctl's dropping of
+    # permissions b) need to wait for startup to have finished, and we don't
+    # currently have a tool for that...
+    CIRRUS_ESCAPING_PROCESSES: 1
 
   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
 
-- 
2.35.1.354.g715d08a9e5

Reply via email to