Skip to contentSkip to conversation

Opening of blocking FIFOs not reliable?

DISCUSSION Manfred Spraul 2 participants 2 messages Aug 14, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines · Teemu

Opening a FIFO for WR_ONLY should release a previously blocked RD_ONLY open. I suspect this is not guaranteed on a heavily loaded Linux box.

Do you have a test case?
IIRC we had that bug, and it was fixed by adding PIPE_WCOUNTER:
PIPE_WRITERS counts the number of writers. This one is decreased during close(). PIPE_WCOUNTER counts how often a writer was seen. It's never decreased. Readers that wait for a writer wait until PIPE_WCOUNTER changes, they do not look at PIPE_WRITERS.

--
Manfred

#1 lore raw
Quoted 5 lines · Manfred Spraul
Quoted 2 lines

Opening a FIFO for WR_ONLY should release a previously blocked RD_ONLY open. I suspect this is not guaranteed on a heavily loaded Linux box.

Do you have a test case?
IIRC we had that bug, and it was fixed by adding PIPE_WCOUNTER:
PIPE_WRITERS counts the number of writers. This one is decreased during close(). PIPE_WCOUNTER counts how often a writer was seen. It's never decreased. Readers that wait for a writer wait until PIPE_WCOUNTER changes, they do not look at PIPE_WRITERS.

Ah, I missed the semantics of WCOUNTER. True, writer's open should always release the reader' s open (as Alan pointed out).

I do have a test application, which experienced dead-locked readers' opens before I artificially delayed writers' closes. The application runs on PlanetLab, which uses VServer, though. I'll try to construct next a minimal test case based on the application and reproduce the behavior on a vanilla box...

Teemu

--