Hello,

We encountered an issue in GNU Classpath 0.91 (same issue in 0.92 but not
in 0.93): in SocketIoProcessor.read(SocketSessionImpl), the
SocketChannel.read(ByteBuffer) call was erroneously returning -1 instead of
0 when the buffer was full but more data was to be read. It caused a reset
of the connection even if the connection itself was ok and still open.

Classpath 0.93 fixed this problem (release notes here:
http://www.gnu.org/software/classpath/announce/20061211.html). We had to
work with classpath 0.91 for some reasons, so I partially fixed the problem
by replacing

if (ret < 0) {
    scheduleRemove(session);
}

by

// If the buffer was full, there may be more bytes to read
if (ret < 0 && readBytes < initialReadBufferSize) {
    scheduleRemove(session);
}

But in some cases (not every time), if the connection closed by the other
peer, I receive a TCP FIN but do not answer and keep reading 0 bytes
forever in the socket. Do you have any idea of a better fix? This solution
never causes trouble in classpath 0.93+ (mainly tested with 0.98 and JamVM
1.5.4), only in 0.92 and lower (tested with 0.91 and JamVM 1.4.3).

Thank you in advance for any answer or hint!

Florent.

Reply via email to