Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tjoXD-00DeWd-8B for pgsql-hackers@arkaria.postgresql.org; Sun, 16 Feb 2025 23:58:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tjoXB-00Bnho-RT for pgsql-hackers@arkaria.postgresql.org; Sun, 16 Feb 2025 23:58:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tjoXB-00BngI-Hr for pgsql-hackers@lists.postgresql.org; Sun, 16 Feb 2025 23:58:49 +0000 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tjoX9-001Cvz-0i for pgsql-hackers@postgresql.org; Sun, 16 Feb 2025 23:58:48 +0000 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3f3dd2069cdso1621559b6e.1 for ; Sun, 16 Feb 2025 15:58:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1739750326; x=1740355126; darn=postgresql.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=dYWXLe5T0N25v5hOGJ+RMR+MiG0Y82/YBkFaQ3tLZ/k=; b=cJx/yPzxv0CnVPQDUkL2Di/fE5B0+btW66wIXWWGp1GOAb/6uCmBR/N4OFaHYECwAv dugwQBSfkOaD0l8TKSU5421p72P4Fre9fOx/jLzvXhqPl1yawvUqD07luZp/0NyGuZYp Bk3INNapKBBctRfKfxBQovOOZaP9Z4nmzeVVc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739750326; x=1740355126; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dYWXLe5T0N25v5hOGJ+RMR+MiG0Y82/YBkFaQ3tLZ/k=; b=lUGK7kLoJcmz6OahfnyJxPAsMsLUvMehe2FV7LjNL2iJPKEsmLVFCmojEf1wMIPUZM geg56YtQlRnHG+8oaszsA1YdEr7/gX+QLm/ekLzzpDfrLpR/blh8j3JbYS34hTGjeTTI +AVQp7aEwYtOkrVCBU0pI6Zh1pHkvw1vLU1oAkOAPj3VpujtdvOn+8eYVeNiaCF4riAB QPs39wUa54Usi1/hPKtJna4VHNzqPjBU55zRw/9w4re34op5NA0TzvBkcp9M14tDY5Qf SKmUYwnY3LS1jHSe9bS1XvhS/Fj8cyXCVsXs6eLR8USJMnv95XK7MKojQ6AvZxNwyqT9 t9uQ== X-Forwarded-Encrypted: i=1; AJvYcCW6Fd3E5rpDMsW75jU5jracBa/KPqDDhen40IodRzJz63US03etE3Xw91cHp9O5dRT2jH1VmMVwf1hqCTnQ@postgresql.org X-Gm-Message-State: AOJu0Yxkq6BbXUnkVcJwRIENIerQXAxsiYoRSxhaVNs+5aQQrsMUnxk7 Cb7aKFWJeB6M32cJsEvRGCGDZ+6RiJNRqIyl9KUP4eIW4oESTg+9jBhemR6p43agGWtwaB7dc/o = X-Gm-Gg: ASbGncuxbLB38glOyD46dQ3f75ZNqtYcK7HeD0iA9FnoLPwtcejQq9RmgMcKeXM6b/b Cnu7ZqQ2GDf2lsB7tIHyLuIvPXYy8vx8Q+MvKmAve/Q5AO+T6tX6IT2BcawLLs747yvm9yMYWfW J09+UCn8FrYSTPCypSEeyWCrG9B3ONQpwYU3CXbo+zwtQROSw8jSiZdqCEXLOW7c6MCjS8o2Qpd Mker3sVZMJ3TgvgP53t0ku6bhExmavGxI3kJ6ieRdF2Ka+CfeDDTLM8HMSffTHmCiHJ5FAZSlKk f9/Spa5oUQ== X-Google-Smtp-Source: AGHT+IHhcc31MxkbVP9kkZ910Xg98YCCUvYPp4EIT3LbSR3dwTX8t7jFXt1ldmZnNwpfHh5pSmW/YA== X-Received: by 2002:a05:6808:80c3:b0:3ea:5ab4:584d with SMTP id 5614622812f47-3f3eb145b2dmr4639990b6e.33.1739750326580; Sun, 16 Feb 2025 15:58:46 -0800 (PST) Received: from google.com ([2600:1702:a20:5750::46]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3f3daa18b5fsm2938974b6e.46.2025.02.16.15.58.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Feb 2025 15:58:45 -0800 (PST) Date: Sun, 16 Feb 2025 15:58:43 -0800 From: Noah Misch To: Tom Lane Cc: Andres Freund , pgsql-hackers@postgresql.org Subject: Re: BackgroundPsql swallowing errors on windows Message-ID: <20250216235843.7c.nmisch@google.com> References: <20250216173943.b6.nmisch@google.com> <20250216184740.55.nmisch@google.com> <20250216223951.a3.nmisch@google.com> <684214.1739747924@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <684214.1739747924@sss.pgh.pa.us> User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Feb 16, 2025 at 06:18:44PM -0500, Tom Lane wrote: > Noah Misch writes: > > From the slow proxy's perspective, it can't rule out the program under test > > having done those two write() calls. The proxy doesn't have enough > > information to reconstruct the original four write() calls. What prevents > > that anomaly? > > Yeah, I think it's hopeless to expect that we can disambiguate the > order of writes to two different pipes. For the problem at hand, > though, it seems like we don't really need to do that. Rather, the > question is "when we detect that the program-under-test has exited, > can we be sure we have collected all of its output?". In the BackgroundPsql case, we have output collection moments for every query while the psql-under-test is running, not just after exit. If I understand the original post right, the specifics are as follows. If $stdout witnesses the result of '\echo BANNER', $stderr should contain anything from psql commands before the \echo. That holds on non-Windows, but the IPC::Run proxy makes it not hold on Windows. > I think that > IPC::Run may be screwing up here, because I have seen non-Windows > CI failures that look like it didn't read all the stderr output. > For example, this pgbench test failure on macOS from [1]: > > # Running: pgbench -n -t 1 -Dfoo=bla -Dnull=null -Dtrue=true -Done=1 -Dzero=0.0 -Dbadtrue=trueXXX -Dmaxint=9223372036854775807 -Dminint=-9223372036854775808 -M prepared -f /Users/admin/pgsql/build/testrun/pgbench/001_pgbench_with_server/data/t_001_pgbench_with_server_main_data/001_pgbench_error_shell_bad_command > [17:27:47.408](0.061s) ok 273 - pgbench script error: shell bad command status (got 2 vs expected 2) > [17:27:47.409](0.000s) ok 274 - pgbench script error: shell bad command stdout /(?^:processed: 0/1)/ > [17:27:47.409](0.000s) not ok 275 - pgbench script error: shell bad command stderr /(?^:\(shell\) .* meta-command failed)/ > [17:27:47.409](0.000s) # Failed test 'pgbench script error: shell bad command stderr /(?^:\(shell\) .* meta-command failed)/' > # at /Users/admin/pgsql/src/bin/pgbench/t/001_pgbench_with_server.pl line 1466. > # '' > # doesn't match '(?^:\(shell\) .* meta-command failed)' > > The program's exited with a failure code as expected, and we saw (some > of?) the expected stdout output, but stderr output is reported to be > empty. https://github.com/cpan-authors/IPC-Run/commit/2128df3bbcac7e733ac46302c4b1371ffb88fe14 fixed that one. > [1] https://cirrus-ci.com/task/6221238034497536