seanjensengrey / jmemcache-daemon

Automatically exported from code.google.com/p/jmemcache-daemon
Apache License 2.0
0 stars 0 forks source link

FrameDecoder bug #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
if a buffer endwith "\r" not end with "\r\n",the line 
"buffer.skipBytes(minFrameLength + minDelimLength);" will throw a exception.

if (frameLength >= 0 && frameLength < minFrameLength ) {
minFrameLength = frameLength;
foundDelimiter = MemcachedResponseEncoder.CRLF;
}
should be changed 

if (frameLength >= 0 && frameLength < minFrameLength &&     
buffer.readableBytes() >= frameLength + 2) {
minFrameLength = frameLength;
foundDelimiter = MemcachedResponseEncoder.CRLF;
}

Original issue reported on code.google.com by sunli1...@gmail.com on 17 Sep 2010 at 2:28

GoogleCodeExporter commented 9 years ago
Which client sends \r as a line terminator?

Original comment by ryan.daum on 4 Nov 2010 at 9:31

GoogleCodeExporter commented 9 years ago
In a stream-based transport such as TCP/IP, packets can be fragmented  during 
transmission even in a LAN environment.For example, let us assume you have 
received three packets:

 +-----+-----+-----+
 | ABC | DEF | GHI |
 +-----+-----+-----+

because of the packet fragmentation, a server can receive them like the 
following:
 +----+-------+---+---+
 | AB | CDEFG | H | I |
 +----+-------+---+---+
so,client sends \r\n as a line terminator,but server will receive  a buffer 
endwith "\r",the \n is in the next packet .
 the bug  appeared  in my  a  200000qps programe test

Original comment by sunli1...@gmail.com on 5 Nov 2010 at 1:39

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This fix solves the issue perfectly! Highly appreciated.

Original comment by henning@ganix.de on 16 Nov 2010 at 6:05

GoogleCodeExporter commented 9 years ago

Original comment by ryan.daum on 10 Jan 2011 at 6:01

GoogleCodeExporter commented 9 years ago

Original comment by ryan.daum on 10 Jan 2011 at 6:02