BLOCKING and STDOUT/STDERR

  • Thread starter George C. Demetros
  • Start date
G

George C. Demetros

Hi.

We have a Perl routine that prints messages to STDOUT and STDERR. It's possible
that the calling function may have redirected STDOUT/STDERR to FIFO files, and
the Perl routine is unaware of this. It appears that if the FIFO files are not
being read and that the files approach the 32K limit in size, that some sort of
blocking occurs in the Perl routine.

Is there some way of determining, within the Perl routine, when we hit this
limit and/or when blocking occurs so we can gracefully die? Again, the Perl
routine is unaware whether the calling function has redirected STDOUT/STDERR.

Thanks in advance!

George
 
B

Ben Morrow

George C. Demetros said:
We have a Perl routine that prints messages to STDOUT and STDERR. It's possible
that the calling function may have redirected STDOUT/STDERR to FIFO files, and
the Perl routine is unaware of this. It appears that if the FIFO files are not
being read and that the files approach the 32K limit in size, that some sort of
blocking occurs in the Perl routine.

Is there some way of determining, within the Perl routine, when we hit this
limit and/or when blocking occurs so we can gracefully die? Again, the Perl
routine is unaware whether the calling function has redirected STDOUT/STDERR.

The way to deal with this is to use non-blocking IO, which will fail
if the data cannot be written due to a full buffer. See
IO::Handle::blocking.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top