It's nice to know that all I have to do is blunder in ignorantly and
I'll flush the gurus out of hiding :-).  Thanks Mark and Michael for
the illumination.

At 12:35 PM -0800 11/7/03, Mark Berryman wrote:
>The 64K limit for QIO is documented and applies to all devices that use
>QIO (which includes sockets). 

I do expect folks using the QIO interface to know that or be able to
figure it out.  That's a lot to ask, though, of someone using a Perl
module that does socket calls under the hood (that does CRTL calls
under the hood [that does QIOs under the hood]).

At 2:26 PM -0800 11/7/03, Mark Berryman wrote:

>This is NOT a limitation of the OS.  It is a documented requirement for
>TCP-based network programming on ANY platform.

It may even be a characteristic of the write() function generally.
There are apparently reasons other than maximum I/O size limitations
that a write may not transfer everything the first time around, such
as being interrupted by a signal.  See what the Open Group says:

http://www.opengroup.org/onlinepubs/007904975/functions/write.html

At 3:55 PM -0700 11/7/03, Michael Downey wrote:
>Maybe you are missing what the initial problem is with VMS.  You can not
>write a buffer that is > 64K to a socket.  If you try the socket will fail
>to send ANY data, I even think there was a crash bug in the code that's
>likely been fixed.

That's distressing, and could possibly justify doing something in the
guts of the vms-specific parts of Perl.  What would we pick as the
maximum data size?  Does 64K exactly work, or does it have to be
something smaller?  I've poked around a bit in the Perl sources and
it looks like we currently have a jacket around fwrite(), but not
write(), so we're just doing whatever the CRTL does.  I really hate
working around bugs like this because it's so easy to cause long-term
problems or limitations in the process of slapping on a band-aid.

Even if the QIO/CRTL/Perl layers all handled things properly, it
looks like Net::MySQL is not quite as robust as it could be.  The
code is located here:

http://search.cpan.org/src/OYAMA/Net-MySQL-0.08/MySQL.pm

An only slightly simplified snippet of the offending code, where
$mysql is a socket object, follows:

        $mysql->send($message, 0);

        my $result;
        $mysql->recv($result, BUFFER_LENGTH, 0);

So it's doing a send but not checking to see how many bytes were
actually written; then it's turning around and waiting for a response
packet.  That may be why Carl's code hangs -- it's trying to read a
reply that never shows up.  A nice little project for someone would
be to upgrade Net::MySQL to use Net::Cmd->datasend(), which looks
like it handles all this stuff much more thoroughly.

-- 
________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser

Reply via email to