FULL PRODUCT VERSION :
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Mac OS X and Linux (read below for info)
A DESCRIPTION OF THE PROBLEM :
I first reported this to Apple since I found it on a Mac. They dismissed it though since they confirmed it to also exist on Linux. It's a pretty severe bug so I post it here for you. I haven't tested it on Linux (I have no box) but the answer from Apple was so thorough that I trust them.
---
DatagramChannel.write(ByteBuffer[]) silently discards all data in buffers with an index over 15. Only the first 16 elements are written, the rest are silently ignored.
This is a very serious problem since it is working in Windows and all Java applications which use more than 16 buffers will produce too small Datagrams.
The severity is that it is very hard to find the bug.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run example client code to reproduce the problem.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Obvious
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
try {
DatagramChannel channel = DatagramChannel.open();
channel.connect(new InetSocketAddress("localhost", 50000));
channel.configureBlocking(true);
channel.socket().setSendBufferSize(1000000);
int bufferCount = 17; // Only works for 0-16.
ByteBuffer[] buf = new ByteBuffer[bufferCount];
for (int j = 0; j < bufferCount; j++)
buf[j] = ByteBuffer.allocate(1);
long wroteBytes = channel.write(buf);
if (wroteBytes != bufferCount)
System.out.println(wroteBytes + " != " + bufferCount);
} catch (IOException e) {
e.printStackTrace();
}
---------- END SOURCE ----------
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Mac OS X and Linux (read below for info)
A DESCRIPTION OF THE PROBLEM :
I first reported this to Apple since I found it on a Mac. They dismissed it though since they confirmed it to also exist on Linux. It's a pretty severe bug so I post it here for you. I haven't tested it on Linux (I have no box) but the answer from Apple was so thorough that I trust them.
---
DatagramChannel.write(ByteBuffer[]) silently discards all data in buffers with an index over 15. Only the first 16 elements are written, the rest are silently ignored.
This is a very serious problem since it is working in Windows and all Java applications which use more than 16 buffers will produce too small Datagrams.
The severity is that it is very hard to find the bug.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run example client code to reproduce the problem.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Obvious
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
try {
DatagramChannel channel = DatagramChannel.open();
channel.connect(new InetSocketAddress("localhost", 50000));
channel.configureBlocking(true);
channel.socket().setSendBufferSize(1000000);
int bufferCount = 17; // Only works for 0-16.
ByteBuffer[] buf = new ByteBuffer[bufferCount];
for (int j = 0; j < bufferCount; j++)
buf[j] = ByteBuffer.allocate(1);
long wroteBytes = channel.write(buf);
if (wroteBytes != bufferCount)
System.out.println(wroteBytes + " != " + bufferCount);
} catch (IOException e) {
e.printStackTrace();
}
---------- END SOURCE ----------
- duplicates
-
JDK-7176485 (bf) Allow temporary buffer cache to grow to IOV_MAX
-
- Closed
-