Hide Forgot
project_key: EDG When given following input: [mlinhard@michal-linhard ~]$ echo -e "cas bad blah 0 0 0\r\n\r\n" | nc localhost 11211 SERVER_ERROR org.infinispan.server.core.ServerException: java.lang.NumberFormatException: For input string: "blah" [mlinhard@michal-linhard ~]$ echo -e "cas bad 0 blah 0 0\r\n\r\n" | nc localhost 11211 SERVER_ERROR org.infinispan.server.core.ServerException: java.lang.NumberFormatException: For input string: "blah" [mlinhard@michal-linhard ~]$ echo -e "cas bad 0 0 blah 0\r\n\r\n" | nc localhost 11211 SERVER_ERROR org.infinispan.server.core.ServerException: java.lang.NumberFormatException: For input string: "blah" [mlinhard@michal-linhard ~]$ echo -e "cas bad 0 0 0 blah\r\n\r\n" | nc localhost 11211 SERVER_ERROR org.infinispan.server.core.ServerException: java.lang.NumberFormatException: For input string: "blah" in each case memcached server module should have replied with "CLIENT_ERROR <error>\r\n" as required in: https://github.com/memcached/memcached/blob/master/doc/protocol.txt FYI: original memcached server implementation replies "CLIENT_ERROR bad command line format\r\n" (which is also expected by their test suite, but not required by protocol)
and one more related thing: missing cas value should result in CLIENT_ERROR instead SERVER_ERROR: [mlinhard@michal-linhard ~]$ echo -e "cas foo 0 0 6 \r\nbarva2\r\n" | nc localhost 11211 SERVER_ERROR org.infinispan.server.core.ServerException: java.lang.ArrayIndexOutOfBoundsException: 3 but in this case I'm a bit uncertain because original memcached server replies ERROR here. to me this seems like a bug on their side, because the mentioned input "cas foo 0 0 6 \r\nbarva2\r\n" is not an unknown command (=ERROR) but " error in the input line, i.e. the input doesn't conform to the protocol in some way" (=CLIENT_ERROR)
Thanks Michal. Wrt your last comment, one thing is for sure, it shouldn't throw an ArrayIndexOutOfBoundsException, so I'll go with a CLIENT_ERROR for that.
Actually, I know why it sends an ERROR saying unknown command. That's cos after \r\n, a new command starts, and hence barva2 is not a known command. The server is right on this.
Not sure actually. I'll double check what the server does with "cas foo 0 0 6 \r\nbarva2\r\n" to be more precise and get back to you.
Link: Added: This issue depends ISPN-773
It seems like Memcached server is just sending you the last of the errors, which indeed is an unknown command, but this is just a side effect of the first error, which is the lack of the cas id. I'm gonna go with CLIENT_ERROR cos, as you rightly pointed out, that's the real issue here.
Yes, there's one ERROR for the "barva2\r\n" input as well, but it says error also to the first line (the original memcached implementation): $ echo -e "cas foo 0 0 6 \r\nbarva2\r" | nc localhost 11212 ERROR ERROR $ echo -e "cas foo 0 0 6 \r" | nc localhost 11212 ERROR
Oh right, it mentions both. I've coded it to show the first which is the key one as CLIENT_ERROR. I don't think we should get too hang up on this though.