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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |