leeoo / spymemcached

Automatically exported from code.google.com/p/spymemcached
0 stars 0 forks source link

Cannot connect to Coubhbase's memcached bucket with SASL from 2.8.10 #272

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?

spymemcached 2.8.10, 2.8.11, 2.8.12

Tell me more...

I get "Auth failure" errors while trying to connect Couchbase's memcached 
bucket with SASL.
spymemcached from 2.8.4 to 2.8.9 worked fine with the same setup(Couchbase 2.0, 
same bucket name and password).

Also, here's the stack trace.

2013-03-31 12:34:15.274 ERROR 
net.spy.memcached.protocol.binary.NoopOperationImpl:  Error:  Auth failure
2013-03-31 12:34:15.274 WARN 
net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl:  Discarding 
partially completed op: Cmd: 10 Opaque: 1
2013-03-31 12:34:15.274 INFO net.spy.memcached.MemcachedConnection:  
Reconnection due to exception handling a memcached operation on {QA 
sa=/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, 
toWrite=0, interested=8}. This may be due to an authentication failure.
OperationException: SERVER: Auth failure
    at net.spy.memcached.protocol.BaseOperationImpl.handleError(BaseOperationImpl.java:164)
    at net.spy.memcached.protocol.binary.OperationImpl.finishedPayload(OperationImpl.java:176)
    at net.spy.memcached.protocol.binary.OperationImpl.readFromBuffer(OperationImpl.java:162)
    at net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:537)
    at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:430)
    at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:247)
    at net.spy.memcached.MemcachedConnection.run(MemcachedConnection.java:915)
2013-03-31 12:34:15.276 WARN net.spy.memcached.MemcachedConnection:  Closing, 
and reopening {QA sa=/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, 
topWop=null, toWrite=0, interested=8}, attempt 1.

Original issue reported on code.google.com by yku...@gmail.com on 31 Mar 2013 at 3:55

GoogleCodeExporter commented 9 years ago
I have this same problem with 2.8.4 and 2.8.9. Using wireshark, I was able to 
determine that spymemcached is sending a noop operation to the server without 
first sending the authentication. I suspect this is happening because of a race 
condition between the call to connect and the registration of the OP_CONNECT 
selection key.

Original comment by cgri...@gmail.com on 3 Apr 2013 at 4:04

GoogleCodeExporter commented 9 years ago
Hi,

the noop has been implemented to make sure that we can detect "zombie" memcache 
processes, for example those that are responding on the socket but are actually 
dead.

We ran the tests against both vanilla memcached and also couchbase buckets.

Is it possible that you guys provide mor info on your environment so we can 
debug the issue?
THanks!

Original comment by michael....@gmail.com on 3 Apr 2013 at 6:52

GoogleCodeExporter commented 9 years ago
Thanks for your reply,

I reproduced the problem on my MBP Retina 2012 running Mountain Lion and 
Couchbase 2.0 installed via Homebrew.
Please let me know if you need anything else!

Original comment by yku...@gmail.com on 3 Apr 2013 at 1:08

GoogleCodeExporter commented 9 years ago
I recreate this issue 100% of the time on my MacBook Pro (OS 10.8.3) and on 
Heroku connecting to either of free accounts provided by Heroku (via NorthScale 
aka Couchbase) or Memcachier.

Mac Java:
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)

Heroku Java:
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.4) (Ubuntu build 1.6.0_27-b27)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

Original comment by cgri...@gmail.com on 3 Apr 2013 at 3:51

GoogleCodeExporter commented 9 years ago
I have the same problem reported by original ticket opener.
Server framework is PlayFramework 2.1 connecting to memcached server using the 
https://github.com/mumoshu/play2-memcached module.  Everything worked fine 
until play2-memcached module upgraded to spymemcached 2.8.10.  Development 
environment is windows 7, Java 7_15, Couchbase 2.0.  Authentication issue 
happens on both their couchbase bucket and memcached bucket.
Let me know if there is anything else I can provide that could help.

Original comment by enalm...@gmail.com on 3 Apr 2013 at 7:27

GoogleCodeExporter commented 9 years ago
This issue has also been reported at 
https://groups.google.com/forum/?fromgroups=#!topic/clojure-memcached/_wBnwRXwb3
M

Original comment by cgri...@gmail.com on 3 Apr 2013 at 7:35

GoogleCodeExporter commented 9 years ago
To those also blocked by this issue, I was able to switch to xmemcached using 
AuthInfo.plain (AuthInfo.typical did not work for my servers) and get my app 
working.

Original comment by cgri...@gmail.com on 18 Apr 2013 at 4:20

GoogleCodeExporter commented 9 years ago
I'll look into this today and report my findings. We added some stuff in 2.8.10 
to make sure connections are established properly which may be part of the 
problem reported here.

Original comment by michael....@gmail.com on 19 Apr 2013 at 6:36

GoogleCodeExporter commented 9 years ago
Okay, so please use port 11210 if you are doing SASL auth against a memcached 
bucket on a couchbase system!

    AuthDescriptor authDescriptor = new AuthDescriptor(new String[]{"PLAIN"},
      new PlainCallbackHandler("cache", "cache"));

    ConnectionFactory fact = new ConnectionFactoryBuilder()
      .setProtocol(ConnectionFactoryBuilder.Protocol.BINARY)
      .setAuthDescriptor(authDescriptor)
      .build();

    MemcachedClient client = new MemcachedClient(fact, Arrays.asList(new InetSocketAddress("127.0.0.1", 11210)));

    client.set("foo", 0, "value");
    System.out.println(client.get("foo"));

    client.shutdown();

Code like this should work if you have a memcached bucket called "cache" with a 
"cache" password. Let me know if this works for you!

11211 is moxi for the default bucket, you don't need to have SASL in place 
there.

Let me know if this works for you guys, watch out the memcache ports against a 
couchbase server!

Original comment by michael....@gmail.com on 19 Apr 2013 at 12:01