7176630: (sc) SocketChannel.write does not write more than 128k when channel configured blocking [win]
Esmond Pitt
esmond.pitt at bigpond.com
Wed Jun 13 16:28:47 PDT 2012
Alan
I suggest the loop should only happen in blocking mode, if at all.
Non-blocking mode programs must already cope with short writes, and
shouldn't be held up dispatching writes, on fairness grounds. I'm not
convinced about the need for the loop in blocking mode either, as
applications must be written correctly, and forums are already full of war
stories about checking write (and read) return values in java.nio and indeed
java.net and java.io.
EJP
-----Original Message-----
From: nio-dev-bounces at openjdk.java.net
[mailto:nio-dev-bounces at openjdk.java.net] On Behalf Of
nio-dev-request at openjdk.java.net
Sent: Thursday, 14 June 2012 5:00 AM
To: nio-dev at openjdk.java.net
Subject: nio-dev Digest, Vol 51, Issue 8
Send nio-dev mailing list submissions to
nio-dev at openjdk.java.net
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.openjdk.java.net/mailman/listinfo/nio-dev
or, via email, send a message with subject or body 'help' to
nio-dev-request at openjdk.java.net
You can reach the person managing the list at
nio-dev-owner at openjdk.java.net
When replying, please edit your Subject line so it is more specific than
"Re: Contents of nio-dev digest..."
Today's Topics:
1. 7176630: (sc) SocketChannel.write does not write more than
128k when channel configured blocking [win] (Alan Bateman)
2. Re: 7176630: (sc) SocketChannel.write does not write more
than 128k when channel configured blocking [win] (Wolfgang Baltes)
3. Re: 7176630: (sc) SocketChannel.write does not write more
than 128k when channel configured blocking [win] (Kurchi Subhra Hazra)
4. Re: 7176630: (sc) SocketChannel.write does not write more
than 128k when channel configured blocking [win] (Alan Bateman)
5. Re: 7176630: (sc) SocketChannel.write does not write more
than 128k when channel configured blocking [win] (Alan Bateman)
6. Re: 7176630: (sc) SocketChannel.write does not write more
than 128k when channel configured blocking [win] (Kurchi Hazra)
----------------------------------------------------------------------
Message: 1
Date: Wed, 13 Jun 2012 14:54:23 +0100
From: Alan Bateman <Alan.Bateman at oracle.com>
Subject: 7176630: (sc) SocketChannel.write does not write more than
128k when channel configured blocking [win]
To: nio-dev <nio-dev at openjdk.java.net>
Message-ID: <4FD89B8F.3000704 at oracle.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
I need a reviewer for a small change to the SocketChannel.write
implementation on Windows. The issue on Windows is that we limit the buffer
size to 128k-1 because asynchronous close doesn't work on Windows for sizes
later than that (the long standing Microsoft recommendation is to use
<=64k). The issue with limiting the size of the I/O operation is that the
write method may return a value less than what is expected when the channel
is configured blocking and this can cause problem for applications that
don't check the return value. The changes just convert the large write into
multiple calls to WSASend. The webrev with the changes is here:
http://cr.openjdk.java.net/~alanb/7176630/webrev/
Thanks,
Alan.
------------------------------
Message: 2
Date: Wed, 13 Jun 2012 09:01:56 -0700
From: Wolfgang Baltes <wolfgang.baltes at laposte.net>
Subject: Re: 7176630: (sc) SocketChannel.write does not write more
than 128k when channel configured blocking [win]
To: Alan Bateman <Alan.Bateman at oracle.com>
Cc: nio-dev <nio-dev at openjdk.java.net>
Message-ID: <4FD8B974.7060606 at laposte.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Looks ok to me.
Wolfgang.
On 2012-06-13 06:54, Alan Bateman wrote:
>
> I need a reviewer for a small change to the SocketChannel.write
> implementation on Windows. The issue on Windows is that we limit the
> buffer size to 128k-1 because asynchronous close doesn't work on
> Windows for sizes later than that (the long standing Microsoft
> recommendation is to use <=64k). The issue with limiting the size of
> the I/O operation is that the write method may return a value less
> than what is expected when the channel is configured blocking and this
> can cause problem for applications that don't check the return value.
> The changes just convert the large write into multiple calls to
> WSASend. The webrev with the changes is here:
>
> http://cr.openjdk.java.net/~alanb/7176630/webrev/
>
> Thanks,
> Alan.
>
>
------------------------------
Message: 3
Date: Wed, 13 Jun 2012 09:24:14 -0700
From: Kurchi Subhra Hazra <kurchi.subhra.hazra at oracle.com>
Subject: Re: 7176630: (sc) SocketChannel.write does not write more
than 128k when channel configured blocking [win]
To: nio-dev at openjdk.java.net
Message-ID: <4FD8BEAE.9030103 at oracle.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Just out of curiosity - why are you doing multiple calls to WSASend as
opposed to setting up and sending multiple buffers with one call?
- Kurchi
On 6/13/12 9:01 AM, Wolfgang Baltes wrote:
> Looks ok to me.
> Wolfgang.
>
> On 2012-06-13 06:54, Alan Bateman wrote:
>>
>> I need a reviewer for a small change to the SocketChannel.write
>> implementation on Windows. The issue on Windows is that we limit the
>> buffer size to 128k-1 because asynchronous close doesn't work on
>> Windows for sizes later than that (the long standing Microsoft
>> recommendation is to use <=64k). The issue with limiting the size of
>> the I/O operation is that the write method may return a value less
>> than what is expected when the channel is configured blocking and
>> this can cause problem for applications that don't check the return
>> value. The changes just convert the large write into multiple calls
>> to WSASend. The webrev with the changes is here:
>>
>> http://cr.openjdk.java.net/~alanb/7176630/webrev/
>>
>> Thanks,
>> Alan.
>>
>>
>
>
------------------------------
Message: 4
Date: Wed, 13 Jun 2012 17:27:34 +0100
From: Alan Bateman <Alan.Bateman at oracle.com>
Subject: Re: 7176630: (sc) SocketChannel.write does not write more
than 128k when channel configured blocking [win]
To: Wolfgang Baltes <wolfgang.baltes at laposte.net>
Cc: nio-dev <nio-dev at openjdk.java.net>
Message-ID: <4FD8BF76.80503 at oracle.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 13/06/2012 17:01, Wolfgang Baltes wrote:
> Looks ok to me.
> Wolfgang.
Thanks Wolfgang but for the change-set I need to get an official reviewer.
-Alan.
------------------------------
Message: 5
Date: Wed, 13 Jun 2012 17:46:58 +0100
From: Alan Bateman <Alan.Bateman at oracle.com>
Subject: Re: 7176630: (sc) SocketChannel.write does not write more
than 128k when channel configured blocking [win]
To: Kurchi Subhra Hazra <kurchi.subhra.hazra at oracle.com>
Cc: nio-dev at openjdk.java.net
Message-ID: <4FD8C402.4040303 at oracle.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 13/06/2012 17:24, Kurchi Subhra Hazra wrote:
> Just out of curiosity - why are you doing multiple calls to WSASend as
> opposed to setting up and sending multiple buffers with one call?
>
> - Kurchi
The issue is the asynchronous close when the total size (over all
buffers) is >= 128k.
-Alan
------------------------------
Message: 6
Date: Wed, 13 Jun 2012 10:40:26 -0700
From: Kurchi Hazra <kurchi.subhra.hazra at oracle.com>
Subject: Re: 7176630: (sc) SocketChannel.write does not write more
than 128k when channel configured blocking [win]
To: Alan Bateman <Alan.Bateman at oracle.com>
Cc: nio-dev at openjdk.java.net
Message-ID: <4FD8D08A.8010106 at oracle.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 6/13/2012 9:46 AM, Alan Bateman wrote:
> On 13/06/2012 17:24, Kurchi Subhra Hazra wrote:
>> Just out of curiosity - why are you doing multiple calls to WSASend
>> as opposed to setting up and sending multiple buffers with one call?
>>
>> - Kurchi
> The issue is the asynchronous close when the total size (over all
> buffers) is >= 128k.
I see. Thanks!
- Kurchi
End of nio-dev Digest, Vol 51, Issue 8
**************************************
More information about the nio-dev
mailing list