Bug 745825 (EDG-97)

Summary: CLIENT_ERROR caused by exceeding key length in memcached server module closes connection with client
Product: [JBoss] JBoss Data Grid 5 Reporter: Michal Linhard <mlinhard>
Component: InfinispanAssignee: Default User <jbpapp-maint>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: nobody
Target Milestone: ---   
Target Release: EAP 5.1.0 EDG TP   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/EDG-97
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-24 12:12:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Michal Linhard 2010-11-17 16:23:42 UTC
project_key: EDG

in original memcached server this is possible:

$ export KEY300=<key with length 300 chars>
$ echo -e "add $KEY300 0 0 1\r\nget a\r" | nc localhost 11212
CLIENT_ERROR bad command line format
END

i.e. the second get command gets processed
our server:
$ echo -e "add $KEY300 0 0 1\r\nget a\r" | nc localhost 11211
CLIENT_ERROR org.infinispan.server.core.ServerException: java.io.IOException: Key length over the 250 character limit

what happens is following:
1. key is read up to "add $KEY300 " and exception is thrown
org.infinispan.server.core.ServerException: java.io.IOException: Key length over the 250 character limit
2. this is sent back to client as CLIENT_ERROR and connection is closed
3. next command is read from input "0 0 1\r\nget a\r" leading to
org.infinispan.server.core.UnknownOperationException: Unknown operation: 0
4. SERVER_ERROR (should be ERROR, but JBPAPP-5413 deals with this) is attempted to be sent to client
5. connection is already closed so we have
java.nio.channels.ClosedChannelException

it's actually two issues here
A. step 2 shouldn't close connection because this is allowed only on SERVER_ERRORs
B. before CLIENT_ERROR is sent to client we should have read the whole line of input (the remaining "0 0 1\r\n") so that we don't get this in step 3

Comment 1 Michal Linhard 2010-11-17 16:24:38 UTC
oh, forgot to mention that I'm already testing with infinispan 4.2.0.BETA1

Comment 2 Michal Linhard 2010-11-17 16:27:09 UTC
errors 3 and 5. can be only seen in server log, they are not returned to the client

Comment 3 Galder ZamarreƱo 2010-11-18 10:21:00 UTC
Link: Added: This issue depends ISPN-782


Comment 4 Galder ZamarreƱo 2010-11-18 10:21:02 UTC
Link: Added: This issue depends ISPN-783


Comment 5 Michal Linhard 2010-11-19 16:08:41 UTC
one more testcase for ISPN-783:
echo -e "cas bad 0 0 1 0 0\r\nget a\r" | nc localhost 11211
(the get command gets lost)