[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] select() bug???



I have written a non-threaded web server for the Mac that runs under
MacPerl.  It works perfectly fine except for a particularly nasty bug -
when a browser requests a page with lots of embedded images, the requests
for almost all of the images are lost and hence don't get uploaded to the
browser.  When sitting on the tightest possible loop which repeatedly
checks, using select(), for whether the socket I have set up with the
client is ready to be read from (i.e. another request is coming in), many
of the requests don't show up.  To check, I printed them out line-by-line
as they came in.  The ones that do show get correctly uploaded to the
browser.

I have absolutely no idea where the data which does not show up goes.  I
don't get any error messages from select() - it just times out.

When an HTTP 1.1 compliant browser tries to upload a web page with lots and
lots of images, it sends out requests for all of those images in one
violent burst.  Is this too much for MacPerl's implementation of the
select() command to handle???

Just today I ported my server to be run under UNIX Perl and tested it out
on a workstation.  I made no changes in the code other than making the
file-paths UNIX friendly.  No requests were lost and the server ran
beautifully.  In fact, it truly blazed!!!

As everything works fine under UNIX, it seems to me that this problem must
be due to a bug in MacPerl - possibly with the select() routine although it
is likely a more fundamental problem.  I have observed this bug both when
using the IO::Select package and when using the raw, built in select()
function by hand.  I am using the latest version of MacPerl (5.19r4) to run
the server.  This bug has been independently observed by a number of
different people on a number of different Macs with a number of different
network configurations.

I have been driving myself crazy as until now I had assumed this bug was
due to something I was doing wrong.  Now I am convinced that this bug is
due to a problem with MacPerl.

The source code for my server can be found at http://www.reed.edu/~ckasow/.
The version at my web page uses the IO::Select package and hence is a
little easier to read, possibly at the price of being a little more
inefficient (probably negligably so).

If anyone wants to take a look at either the version which does the
select() stuff by hand, or at the version which runs under UNIX, just email
me.

-Clay Kasow
ckasow@reed.edu



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch