spymemcached compatibility

Alexander Zaitsev alexander.zaitsev at webamg.com
Mon May 12 12:52:03 UTC 2008

Hi all,

I've tried spymemcached Java client instead of Danga one and have faced 
into the strange problem. I use memcached in the short live small Java 
application, that does some staff, communicates with memcached and 
exits. Usually, it takes 1-30 seconds, depending on some conditions.

When I switched from Danga to spymemcached, the program stopped to quite 
normally. The main() finishes, but Java process does not exit. I have 
added explicit System.exit() call and it seemed to help, but not always. 
Sometimes JVM still fails to exist and waits on unknown condition. Below 
is the thread dump.

Looking at google search results for "waiting on condition" I can tell 
that this is not a common problem that sometimes may be related to nio. 
In one case problem disappeared after upgrading the Linux kernel. 
However, kernel upgrade is not an option for us, at least now.

I wonder if anybody experienced the same problem and what can we do?


Full thread dump Java HotSpot(TM) Server VM (1.5.0_10-b03 mixed mode):

"DestroyJavaVM" prio=1 tid=0x9c705ac8 nid=0x7e4d waiting on condition 

"Memcached IO over {MemcachedConnection to localhost/}" 
prio=1 tid=0x9c73f320 nid=0x7e6a runnable [0x9aae3000..0x9aae4140]
        at sun.nio.ch.PollArrayWrapper.poll0(Native Method)
        at sun.nio.ch.PollArrayWrapper.poll(PollArrayWrapper.java:100)
        at sun.nio.ch.PollSelectorImpl.doSelect(PollSelectorImpl.java:56)
        at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
        - locked <0xa1492ad8> (a sun.nio.ch.Util$1)
        - locked <0xa1492ac8> (a java.util.Collections$UnmodifiableSet)
        - locked <0xa1492968> (a sun.nio.ch.PollSelectorImpl)
        at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
        at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:1066)

"Low Memory Detector" daemon prio=1 tid=0x081234e8 nid=0x7e62 runnable 

"CompilerThread1" daemon prio=1 tid=0x08122010 nid=0x7e61 waiting on 
condition [0x00000000..0x9cc02eb8]

"CompilerThread0" daemon prio=1 tid=0x08120f60 nid=0x7e60 waiting on 
condition [0x00000000..0x9cc83038]

"AdapterThread" daemon prio=1 tid=0x0811fdd0 nid=0x7e5f waiting on 
condition [0x00000000..0x00000000]

"Signal Dispatcher" daemon prio=1 tid=0x0811efa8 nid=0x7e5e waiting on 
condition [0x00000000..0x00000000]

"Finalizer" daemon prio=1 tid=0x08114b90 nid=0x7e57 in Object.wait() 
        at java.lang.Object.wait(Native Method)
        - waiting on <0xa13d2ee8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
        - locked <0xa13d2ee8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=1 tid=0x08114610 nid=0x7e56 in 
Object.wait() [0x9cfbc000..0x9cfbc140]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xa1448c28> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:474)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
        - locked <0xa1448c28> (a java.lang.ref.Reference$Lock)

"VM Thread" prio=1 tid=0x081120c0 nid=0x7e55 runnable

"GC task thread#0 (ParallelGC)" prio=1 tid=0x080774f8 nid=0x7e4e runnable

"GC task thread#1 (ParallelGC)" prio=1 tid=0x08078148 nid=0x7e4f runnable

"GC task thread#2 (ParallelGC)" prio=1 tid=0x08078d80 nid=0x7e50 runnable

"GC task thread#3 (ParallelGC)" prio=1 tid=0x080799b8 nid=0x7e51 runnable

"VM Periodic Task Thread" prio=1 tid=0x081249d8 nid=0x7e63 waiting on 

Alexander Zaitsev
AMG Lab Sarl

More information about the memcached mailing list