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 1tWGSS-00FNN2-Ff for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Jan 2025 14:57:56 +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 1tWGSR-00HJK8-Ux for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Jan 2025 14:57:55 +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 1tWGSR-00HJI9-Kv for pgsql-hackers@lists.postgresql.org; Fri, 10 Jan 2025 14:57:55 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tWGSP-000tUS-1H for pgsql-hackers@postgresql.org; Fri, 10 Jan 2025 14:57:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 50AEvjwv2422779; Fri, 10 Jan 2025 09:57:45 -0500 From: Tom Lane To: Fujii Masao cc: Andy Fan , pgsql-hackers Subject: Re: pgbench error: (setshell) of script 0; execution of meta-command failed In-reply-to: References: <87msfz5qv2.fsf@163.com> <87ikqn5em7.fsf@163.com> Comments: In-reply-to Fujii Masao message dated "Fri, 10 Jan 2025 23:39:13 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2422777.1736521065.1@sss.pgh.pa.us> Date: Fri, 10 Jan 2025 09:57:45 -0500 Message-ID: <2422778.1736521065@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Fujii Masao writes: > Before this commit, pgbench used pqsignal() from port/pqsignal.c > to set the signal handler for SIGALRM. This version of pqsignal() > sets SA_RESTART for frontend code, so fgets() in runShellCommand() > wouldn't return NULL even if SIGALRM arrived during fgets(), > preventing the reported error. > On the other hand, currently, pgbench seems to use pqsignal() > from legacy-pqsignal.c, which doesn't set SA_RESTART for SIGALRM. > As a result, SIGALRM can interrupt fgets() in runShellCommand() > and make it return NULL, leading to the reported error. Oh, interesting. > I'm not sure if this change was an intentional result of that commit... Definitely not. I think we'd better look into how to undo that effect. Since legacy-pqsignal is really not supposed to be used by clients anymore, maybe we could just adjust it to set SA_RESTART for SIGALRM? The other alternatives I can think of amount to re-introducing link order dependencies, which would be horrid. regards, tom lane