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: RVP <rvp%SDF.ORG@localhost>
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:07:55 +0000 (UTC)

 On Wed, 6 Aug 2025, furkanonder%protonmail.com@localhost wrote:
 
 > 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.
 >
 
 It almost always isn't as per this reproducer because the child sleeps before
 opening the read end (rather than the writer--parent). For blocking FIFOs,
 there has to be a reader first, before an open(O_WRONLY) returns.
 
 Additionally, the child isn't even doing a read (and the parent doing a write)
 to synchronize things. The child just closes the FIFO immediately. This just
 makes the reproducer _very_ racy.
 
 Put the sleep in the parent (in lieu of a read/write sync) and the reproducer
 works as expected.
 
 >            sleep_ms(50);  // 50ms delay to let parent open writer
 
 The other issues are with the nanosleep() and wait(). With the timer firing
 every 10ms, these _will_ get interrupted and must be retried if errno == EINTR.
 
 -RVP
 


Home | Main Index | Thread Index | Old Index