mod_perl/Apache 2 fixed Re: I/O status Re: SPUG: proper checking...

Fred Morris m3047 at inwa.net
Sat Sep 20 03:19:25 CDT 2003


Well, I set $! = 0 before my while (<FILE>) read loop, and now it properly
and consistently reads files... with no errors. To reiterate, I was having
problems with what appeared to be files corrupted on read. A lot of them
slurped (most of them in fact), but there were several config files which
were read in a line at a time (and an empty file is not an error).
Sometimes a 4 line file would read 4 lines, sometimes it would not.
mod_perl was generally behaving poorly.

The sensible hack of testing $! after the loop was failing on Perl
5.8.0/SuSE Linux 8.2 (x86). Separate testing revealed that open() was
returning successfully but leaving $! set. The error was Inappropriate
ioctl, and strace pinned this on an operation code of SNDCTL_TMR_TIMEBASE,
which is a soundcard call (the machine in question doesn't even have a
sound card!).

Searching on the 'net including Google, SuSE's support database, perlbug
and whatnot turned up no mention of this problem in the context of Perl.
However, there were several mentions of ioctls with SNDCTL_TMR_TIMEBASE in
the context of problems with file I/O. Furthermore, it appears major work
was done on I/O in Perl 5.8.


Ignoring the advice of everyone, I set $! = 0 after the (successful) open
and immediately prior to the while loop in the module which reads the
config files. No more errors at (implicit) end of file (and I'm continuing
to test $! at that point). 4 line files always read at 4 lines. Warns print
in the logs consistently. mod_perl is happy. I'm happy. Do I know why? No.
Does that bother me? Just remember this: Perl doesn't kill problem solving
ability, people kill problem solving ability.

I would like to extend my appreciation to Yitzchak Scott-Thoennes and Brian
Hatch for their insightful suggestions, which didn't lead directly to
solving the problem but which did assist in whacking some of the early
working hypotheses: greatly appreciated, thanks. Well, in retrospect a
close comparative examination of the strace between working and nonworking
systems certainly argues for the virtues of the hack. I'll probably follow
up on Adam Monsen's and Douglas Kirkland's suggestions and at least look at
CGI::Simple, CGI::Minimal and HTTP::Headers, although at this point I
conclude CGI.pm is not the culprit (provided you have the latest version
from Stein's site).

--

Fred Morris
m3047 at inwa.net





More information about the spug-list mailing list