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 1swnV1-0065ye-G9 for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Oct 2024 18:58:00 +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 1swnUy-004IPr-Vb for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Oct 2024 18:57:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1swnUy-004IPh-CG for pgsql-hackers@lists.postgresql.org; Fri, 04 Oct 2024 18:57:56 +0000 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1swnUt-002YCX-N7 for pgsql-hackers@postgresql.org; Fri, 04 Oct 2024 18:57:55 +0000 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-286f1431bceso1325190fac.2 for ; Fri, 04 Oct 2024 11:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1728068271; x=1728673071; darn=postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=x9hsueKs+Jni8vc37KgRSYonvSIQEZhMyypDgsb8zAI=; b=JJUDRbYphXmY0T5ko/GDf+rQnn+J5UktM7T6UJCKwwPJ+eBTrlFYDJf4E0ZzbDBklt bXxpkhzk7cGoeVDso0tTJfdAqYWzrHpvjpkRl7sWf/djZaVnQUok48idK8Y8otYMdjq5 9EW72i/p+bnMgHy6xwY1jykcNAjFgEreSj12U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728068271; x=1728673071; h=user-agent:in-reply-to:content-transfer-encoding :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=x9hsueKs+Jni8vc37KgRSYonvSIQEZhMyypDgsb8zAI=; b=Eghv5Hola3opNwusrAs1oASKtvHJrJNZxJX53tCgyg0mh6uuYEXbEnUov535EC1Mvk J+FEoDHFZCmJzp2tVadueGpK5a2fVo7Ajadu2fb++491vnNR+Aw9Dm5BQiPgkKWqvI6i +itKh+SGvB5DKxeH+uwFbsn99lUbhqNT/nwBvPuSyFhRu3WKSOuoTRx/qyaTCIP26w0x SA42V9Zgb7OYunwTJLiPHPs3A7vPcpZxc26hPRioModXOWtEfq+32CeUTwvgoOWuITLg ZMDv7HC3jJvqoO4KxlPY/YLFz+FzpeQ1BvQcI6LEY0cuObT+sm56zfQUqi18CtKN1gaP 25uA== X-Gm-Message-State: AOJu0Yz5WDsNJme0J90PqkzbxDuHtxWL4r9nhckNxs5+BxrrKmuaTi8C Kh+3eV4w0RxMSDY26EIlgKjGkDnZ4OdLC+HP0i7v8iArWdtOnLCnqz7a1U3nfg== X-Google-Smtp-Source: AGHT+IGwy0ElMjvTqRl6qvvxpeDwk8q/G7NE7XKGvDinN4s7sQ+Dll0OPfMyFKc+DNi/tA4y6FrJaA== X-Received: by 2002:a05:6870:8813:b0:269:2708:afed with SMTP id 586e51a60fabf-287c229544bmr2570597fac.30.1728068270960; Fri, 04 Oct 2024 11:57:50 -0700 (PDT) Received: from google.com ([2600:1702:a20:5750::48]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-287d735be7fsm186038fac.51.2024.10.04.11.57.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Oct 2024 11:57:50 -0700 (PDT) Date: Fri, 4 Oct 2024 11:57:48 -0700 From: Noah Misch To: Alexander Lakhin Cc: pgsql-hackers@postgresql.org, Robert Haas Subject: Re: IPC::Run accepts bug reports Message-ID: <20241004185748.22.nmisch@google.com> References: <20240615234824.a9@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Fri, Oct 04, 2024 at 02:00:00PM +0300, Alexander Lakhin wrote: > sub _read { > ... >     my $r = POSIX::read( $_[0], $s, 10_000 ); >     croak "$!: read( $_[0] )" if not($r) and !$!{EINTR}; > > That is, EINTR kind of recognized as an expected error, but there is no > retry in this case. Thus, with the following modification, which simulates > read() failed with EINTR: >  sub _read { >      confess 'undef' unless defined $_[0]; >      my $s = ''; > -    my $r = POSIX::read( $_[0], $s, 10_000 ); > +    my $r; > +if (int(rand(100)) == 0) > +{ > +   $r = 0;  $! = Errno::EINTR; > +} > +else > +{ > +    $r = POSIX::read( $_[0], $s, 10_000 ); > +} >      croak "$!: read( $_[0] )" if not($r) and !$!{EINTR}; > > I can see failures like the one in question when running that test. That makes sense. Would you file this at https://github.com/cpan-authors/IPC-Run/issues? I suppose that code should become roughly: do { $r = POSIX::read(...) } while (!defined($r) && $!{EINTR}); croak ... unless defined($r); > Perhaps, I could reproduce the issue with a program, that sends signals > to running (pgbench) processes (and thus interrupts read()), if it makes > sense. That should work. Best would be an IPC::Run test case, like the existing t/eintr.t that makes select() report EINTR. That said, IPC::Run could adopt the retry without a test. > [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=indri&dt=2024-10-02%2002%3A34%3A16