Re: Broken pipe problem? If so, why?

xhoster_at_gmail.com
Date: 03/28/05


Date: 28 Mar 2005 15:41:26 GMT

ma@panix.com (malgosia askanas) wrote:
> I have a mail-handling program written in Perl. It gets passed a mail
> message, reads the header, does some processing, and exits. The code for
> reading the header is:
>
> $/ = ''; # paragraph mode
> $header = <>;
>
> I am invoking this program in a pipe from procmail. For some messages (I
> believe, for very large ones) I get the message "Error while writing to
> <progname>" in the procmail log. I would be inclined to believe that
> it's a broken pipe problem, but if so, why does its occurrence depend on
> the message size? The program reads only the header for _all_ messages,
> independent of size - yet in a vast majority of cases, procmail does not
> complain. Can you advise?

Since your Perl program is only reading the header, it must be terminating
while there is still stuff to be read. For short messages, all that stuff
to be read fits in the buffer, so the other end of the pipe doesn't notice.
But for large messages, when the Perl end of the pipe exits the other end
of the pipe gets upset because it is now trying to write to something that
no longer exists. Or something like that.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


Relevant Pages

  • Re: Broken pipe problem? If so, why?
    ... > I am invoking this program in a pipe from procmail. ... just to send teh header?). ... have closed the pipe while procmail still has it open *it* gets sent a SIGPIPE. ...
    (comp.lang.perl.misc)
  • Re: Another Bone Headed...
    ... in vintage cars, like in the Peking to Paris are strongly advised against   ... It could relate to cast iron manifolds only? ... When my header was installed, ... I've studied a fair amount of information regarding exhaust pipe heat. ...
    (rec.autos.makers.vw.aircooled)
  • RE: Help Me with shell script please
    ... Because to my untrained eye your perl script ... > script that accesses the shell a wrapper. ... The "around the mail command" is the important part of ... and any fake header we want to make up on our own). ...
    (RedHat)
  • Re: Downgrade storable under Perl 5.8
    ... Hence Storable running on perl ... with 64 bit integers will read the header from a file written by a 32 bit ... correct backwards compatibility mode. ...
    (comp.lang.perl.modules)
  • Re: use strict; and O_WRONLY
    ... When I created a new XS module with h2xs, ... > constants I wanted to export to Perl. ... I wonder about the necessity of dlsym(). ... be mentioned in the header which has to be included in the XS file. ...
    (comp.lang.perl.misc)