NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/59578: open() hangs indefinitely on FIFO with frequent signal interruption



The following reply was made to PR kern/59578; it has been noted by GNATS.

From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/59578: open() hangs indefinitely on FIFO with frequent signal interruption
Date: Thu, 7 Aug 2025 07:32:11 -0000 (UTC)

 furkanonder%protonmail.com@localhost writes:
 
 >The underlying problem is that when attempting to open a FIFO for writing (O_WRONLY) while the process receives frequent signals,
 >the open() system call gets repeatedly interrupted with EINTR and never completes successfully, even when a reader process is
 >available on the other end.
 
 
 Actually the reproducer is bogus as the nanosleep and more important
 the wait system calls are also interrupted by the signal (and not
 retried).
 
 But if you handle all this, there still seems to be a bug.
 
 What happens is that:
 
 - the parent opens the fifo and gets blocked
 - the child opens the fifo and succeeds, waking the parent
 - the parent gets interrupted before resuming and finishing the
   open system call, so open fails with EINTR.
 - the child closes the fifo and exits.
 - your code retries the open operation of the parent and waits
   forever for the child that is already gone.
 
 
 I'm not sure if that is an allowed scenario, but it would probably be
 better if the interrupted open call would still succeed when the
 reason for blocking is gone at the same time.
 
 An alternative would be to only allow the peer to proceed when
 the open system call returns success. But that synchronisation
 is more complex.
 


Home | Main Index | Thread Index | Old Index