Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memcached-client-java_3.0.1 exception #53

Open
shiyulong opened this issue Dec 13, 2012 · 14 comments
Open

memcached-client-java_3.0.1 exception #53

shiyulong opened this issue Dec 13, 2012 · 14 comments

Comments

@shiyulong
Copy link

Hi, recently, when using memcached-client-java-3.01, I encountered some exceptions as follows:
Exception one:
31065671 [http-10.108.72.170-8080-exec-7] ERROR com.whalin.MemCached.MemCachedClient - ++++ exception thrown while trying to get object from cache for key: _22_channel_id=800000_query=|婴|乐|岛_sort=1_state=0_0
31065671 [http-10.108.72.170-8080-exec-7] ERROR com.whalin.MemCached.MemCachedClient - For input string: "command"
java.lang.NumberFormatException: For input string: "command"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.whalin.MemCached.MemCachedClient.get(Unknown Source)

Exception two:
22153145 [http-10.108.72.170-8080-exec-6] ERROR com.whalin.MemCached.MemCachedClient - Broken pipe
java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:69)
at sun.nio.ch.IOUtil.write(IOUtil.java:26)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
at com.schooner.MemCached.SchoonerSockIOPool$TCPSockIO.flush(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.whalin.MemCached.MemCachedClient.get(Unknown Source)

Exception three:
22152935 [ async update multicache] ERROR com.whalin.MemCached.MemCachedClient - ++++ exception thrown while writing bytes to server on set
22152935 [ async update multicache] ERROR com.whalin.MemCached.MemCachedClient - null
java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:472)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:219)
at com.schooner.MemCached.SockInputStream.read(Unknown Source)
at com.schooner.MemCached.SockInputStream.getLine(Unknown Source)
at com.schooner.MemCached.AscIIClient.set(Unknown Source)
at com.schooner.MemCached.AscIIClient.set(Unknown Source)
at com.whalin.MemCached.MemCachedClient.set(Unknown Source)

When using version 2.5.3, all the best! Now don't know the reason, please help me!

@newroot
Copy link
Collaborator

newroot commented Dec 13, 2012

Could you give me your configuration for the pool and memcached?

for the 1st exception, perhaps you can setSanitizeKeys(true) to avoid special character issue, acctually, it's true by default.

for the other issues, are they frequently appeared or randomly?


Xingen Wang

------------------ Original ------------------
From: "shiyulong"[email protected];
Date: Thu, Dec 13, 2012 07:22 PM
To: "gwhalin/Memcached-Java-Client"[email protected];

Subject: [Memcached-Java-Client] memcached-client-java_3.0.1 exception (#53)

Hi, recently, when using memcached-client-java-3.01, I encountered some exceptions as follows£º
Exception one:
31065671 [http-10.108.72.170-8080-exec-7] ERROR com.whalin.MemCached.MemCachedClient - ++++ exception thrown while trying to get object from cache for key: _22_channel_id=800000_query=|Ó¤|ÀÖ|µº_sort=1_state=0_0
31065671 [http-10.108.72.170-8080-exec-7] ERROR com.whalin.MemCached.MemCachedClient - For input string: "command"
java.lang.NumberFormatException: For input string: "command"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.whalin.MemCached.MemCachedClient.get(Unknown Source)

Exception two:
22153145 [http-10.108.72.170-8080-exec-6] ERROR com.whalin.MemCached.MemCachedClient - Broken pipe
java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:69)
at sun.nio.ch.IOUtil.write(IOUtil.java:26)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
at com.schooner.MemCached.SchoonerSockIOPool$TCPSockIO.flush(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.whalin.MemCached.MemCachedClient.get(Unknown Source)

Exception three:
22152935 [ async update multicache] ERROR com.whalin.MemCached.MemCachedClient - ++++ exception thrown while writing bytes to server on set
22152935 [ async update multicache] ERROR com.whalin.MemCached.MemCachedClient - null
java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:472)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:219)
at com.schooner.MemCached.SockInputStream.read(Unknown Source)
at com.schooner.MemCached.SockInputStream.getLine(Unknown Source)
at com.schooner.MemCached.AscIIClient.set(Unknown Source)
at com.schooner.MemCached.AscIIClient.set(Unknown Source)
at com.whalin.MemCached.MemCachedClient.set(Unknown Source)

When using version 2.5.3, all the best! Now don't know the reason, please help me!

           ¡ª
           Reply to this email directly or view it on GitHub.

@shiyulong
Copy link
Author

The pool configuration like this:
memcached client version: 3.0.1
pool = SockIOPool.getInstance(this.name);
pool.setServers( this.serverList ); //server list
pool.setFailover( false ); // fail over or not
pool.setFailback(false);
pool.setInitConn( 60 );
pool.setMinConn( 60);
pool.setMaxConn( 200 );
pool.setMaintSleep( 30000 ); //
pool.setNagle(false); //nagle algorithms turn on or off
pool.setSocketTO(5000 ); //receive time out in millseconds
pool.setSocketConnectTO(2000);
pool.setAliveCheck( false ); // keep alive
pool.setHashingAlg(SockIOPool.CONSISTENT_HASH);
pool.initialize();
mClient = new MemCachedClient(this.name);
mClient.setPrimitiveAsString(false);
mClient.setSanitizeKeys(false);
mClient.setDefaultEncoding("UTF-8");
memcache configuration as follows:
memcached -d -u syl -m 4096 -l 192.168.1.199 -p 22222
memcached version: 1.4.13

Other issues appeared randomly, average 200~300 per day!

@newroot
Copy link
Collaborator

newroot commented Dec 13, 2012

Since for the special character issue, please use mClient.setSanitizeKeys(true);or else, if space or tab exists in keys, will get format error. Space is an import separator in memcached protocol.------------------Xingen Wang
   ------------------ Original ------------------From:  "shiyulong"[email protected];Date:  Thu, Dec 13, 2012 07:57 PMTo:  "gwhalin/Memcached-Java-Client"[email protected]; Cc:  "Xingen Wang"[email protected]; Subject:  Re: [Memcached-Java-Client] memcached-client-java_3.0.1 exception(#53) The pool configuration like this:
memcached client version: 3.0.1
pool = SockIOPool.getInstance(this.name);
pool.setServers( this.serverList ); //server list
pool.setFailover( false ); // fail over or not
pool.setFailback(false);
pool.setInitConn( 60 );
pool.setMinConn( 60);
pool.setMaxConn( 200 );
pool.setMaintSleep( 30000 ); //
pool.setNagle(false); //nagle algorithms turn on or off
pool.setSocketTO(5000 ); //receive time out in millseconds
pool.setSocketConnectTO(2000);
pool.setAliveCheck( false ); // keep alive
pool.setHashingAlg(SockIOPool.CONSISTENT_HASH);
pool.initialize();
mClient = new MemCachedClient(this.name);
mClient.setPrimitiveAsString(false);
mClient.setSanitizeKeys(false);
mClient.setDefaultEncoding("UTF-8");
memcache configuration as follows:
memcached -d -u syl -m 4096 -l 192.168.1.199 -p 22222
memcached version: 1.4.13

Other issues appeared randomly, average 200~300 per day!

          —
          Reply to this email directly or view it on GitHub.

@newroot
Copy link
Collaborator

newroot commented Dec 13, 2012

did you upgrade your memcached server in the same time?

@shiyulong
Copy link
Author

No, using memcached v1.4.13 all the time. now the lastest version is v1.4.15, need upgrade ?

----did you upgrade your memcached server in the same time?

@newroot
Copy link
Collaborator

newroot commented Dec 13, 2012

no, I just want to confirm.

@newroot
Copy link
Collaborator

newroot commented Dec 13, 2012

How many threads were calling the memcached client? You are recommended to configure same connection pool size, too much big connection pool size will cause concurrent issue. Therefore, if the connection pool size is not big, downward the max conn num.

@shiyulong
Copy link
Author

the second and third exception should not be related to the key, I want to know the reason or how to fix them.

@newroot
Copy link
Collaborator

newroot commented Dec 13, 2012

Yes, I am talking about the last errors. Do you upgrade or downgrade your jvm?

@shiyulong
Copy link
Author

No, my jvm info
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

@newroot
Copy link
Collaborator

newroot commented Dec 14, 2012

if you are using incr/decr storeCounter commands, you should setPrimitiveAsString.
---原始邮件---
发件人:"shiyulong"[email protected]
发送时间:2012年12月14日 星期五 上午10:2
收件人:"gwhalin/Memcached-Java-Client"[email protected]
抄送:"Xingen Wang"[email protected]
主题:Re: [Memcached-Java-Client] memcached-client-java_3.0.1 exception(#53)

No, my jvm info
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

           —
           Reply to this email directly or view it on GitHub.

@shiyulong
Copy link
Author

I have found out the reason, this question has appearred in issue31, #31. The issue can not affect system's performance and function, but it is not a good behavior. I konw the reason due to compatible problem, wish the best to fix it.
Thanks very much! I like your work very much and hope to communicate with you more and more.

@newroot
Copy link
Collaborator

newroot commented Dec 15, 2012

Good to hear that.------------------Xingen Wang
   ------------------ Original ------------------From:  "shiyulong"[email protected];Date:  Fri, Dec 14, 2012 02:26 PMTo:  "gwhalin/Memcached-Java-Client"[email protected]; Cc:  "Xingen Wang"[email protected]; Subject:  Re: [Memcached-Java-Client] memcached-client-java_3.0.1 exception(#53) I have found out the reason, this question has appearred in issue31, #31. The issue can not affect system's performance and function, but it is not a good behavior. I konw the reason due to compatible problem, wish the best to fix it.
Thanks very much! I like your work very much and hope to communicate with you more and more.

          —
          Reply to this email directly or view it on GitHub.

@jcookies
Copy link

I have a question, when I use PHP to add data to the Memcache, Java cannot read error! Data format into string! After viewing a MemCachedClient source code, found to be set flags, Java is based on the stored value types for flags, for example: public static final int MARKER_STRING = 32; and PHP is 0, so the question in this place, throw an exception
example:
94 [main] ERROR com.danga.MemCached.MemCachedClient - ++++ exception thrown while trying to get object from cache for key: operateLog
94 [main] ERROR com.danga.MemCached.MemCachedClient - invalid stream header: 71717171
java.io.StreamCorruptedException: invalid stream header: 71717171
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.(Unknown Source)
at com.schooner.MemCached.ObjectTransCoder.decode(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.danga.MemCached.MemCachedClient.get(Unknown Source)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants