I just played around with this some more (I somehow had the feeling that you know what you're doing... ;)  and I can now reproduce the problem. Initially, I had rather short content in my dummy SQL_REPORT_ID sections. So, to simulate longer read times, I added a sleep 1 like this

... while (<$fh>) { last if (/END SQL_REPORT_ID/) ; $Sql .= "$_"; } sleep 1; ...

and now I'm getting this (when doing print STDERR "Generated $ReportId: $Sql"; in the child):

Generated 1: foo 1 Generated 2: foo 2 Generated 3: foo 3 Generated 4: foo 4 Generated 2: foo 2 Generated 3: foo 3 Generated 4: foo 4 (2..4 repeated ad infinitum...)

This is on HP-UX (no difference between 11.00, 11.11 and 11.23) — on Linux, however, everything is fine. I'll try other platforms later and report back...

For the record, my test file contains:

SQL_REPORT_ID 1 foo 1 END SQL_REPORT_ID SQL_REPORT_ID 2 foo 2 END SQL_REPORT_ID SQL_REPORT_ID 3 foo 3 END SQL_REPORT_ID SQL_REPORT_ID 4 foo 4 END SQL_REPORT_ID

Update: in case anyone is interested, here are the results for a couple of other platforms I could find:

No problem on

but same problem as on HP-UX, on

(don't know what to make of it, yet...)


In reply to Re^3: HPUX corruption of file handle after fork by almut
in thread HPUX corruption of file handle after fork by Abe

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.