Subject: bug#6074: accept-process-output on listening sockets cause non-interruptible infloop

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 14 Sep 2020 15:21:11 +0200

Pip Cet <[email-masked]> writes:

> Why would we try again after receiving EINVAL? I believe the right
> behavior is to return immediately in this case, just as we do for EIO.
>
> However, we should probably call rarely_quit inside the loop, anyway,
> to catch the case of a kernel bug keeping us busy with EINTRs. How's
> this?

[...]

>  	    {
> +	      unsigned int count = 0;
>  	      XSETPROCESS (proc, wait_proc);
>  
>  	      while (true)
>  		{
>  		  int nread = read_process_output (proc, wait_proc->infd);
> +		  rarely_quit (++count);
>  		  if (nread < 0)
>  		    {
> -		      if (errno == EIO || would_block (errno))
> +		      if (errno != EINTR)
>  			break;
>  		    }
>  		  else

There was no followup on this patch at the time (except Richard chiding
you for using forbidden terminology), but I tried the patch now, and it
seems to fix the issue, so I've applied it to the trunk now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no