On 05/13/2011 06:37 AM, Nathan Scott wrote:
> Finally, I had some issues with the command-pipe mode of operation
> in pmdalogger ... have you seen those David/Frank? Don't think I
> broke that with my changes, but could be wrong there - we seem to
> get EBADF always on a pipe fd read. PCP QA test 457 shows off the
> issue, but a conf line like "pipe yes|" is enough to reproduce it.
I looked at this last Thursday, but without much resolution.
There is a problem with 457, since the bash script it runs does 'read
book'. The way the pmdalogger code is written, those scripts won't have
a valid stdin, so that 'read' will immediately return and the script
will exit before 457 has a chance to send it the signal. The pipe'd
process gets started with only 1 open fd - stdout (which of course is
really our pipe).
However, even with 457 changed to use 'while true; do sleep 1; done' to
wait, I'm still not seeing the correct output from the test script.
I'll continue to debug it.
> We'll need to switch from pipe2 to something portable in that code
> (that __pmProcessCreate we discussed earlier), but be good to have
> an understanding of this issue first if possible.
The only advantage pipe2 has over pipe() is that you can set the flags
when the pipe fds are created to avoid a race condition. We should be
able to switch to pipe() without much trouble.
--
David Smith
dsmith@xxxxxxxxxx
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)
|