Re: CGI-Output truncated - what does POLLHUP mean?

Felix von Leitner <[email protected]> Fri, 28 Mar 2008 21:59:47 +0100
Newsgroups gmane.comp.web.fnord
Message-ID <[email protected]>
>    if (pfd[0].revents&POLLHUP) break;

> which aborts reading into the buffer.

> I was wondering about the reasoning behind that. I am by no means an
> expert on pipes and poll, but this looks fishy to me. POLLHUP seems to
> indicate, that the opposite end has closed its side of the pipe. And if
> that is the case fnord gives up. I have the impression that sometimes
> some data is left in a buffer of the pipe though (this even might be
> uclinux specific, no idea actually), which then gets implicitely
> discarded by fnord.

You are supposed to get a POLLHUP if the pipe closed unexpectedly, i.e.
if there is an error on the pipe.

> After removing the line mentioned above I no longer see that happening.
> I just wonder - is this the correct fix? I'm too hazy about the
> semantics of POLLHUP and it seems to have been put there on purpose...  :)

I have never experienced CGI truncation with fnord.  Can you please try
it on a regular Linux and see if you can reproduce it there?

In general, we should also be able to treat POLLHUP like POLLIN, and
then read returns an error.

Felix