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

MemcacheClient with SerializingTranscoder isn't thread safe #315

Open
GoogleCodeExporter opened this issue Feb 16, 2016 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

Version 2.11.2

net.spy.memcached.MemcachedClient.incr(String key, int by, long def, int exp)

sometimes produces this error, when it calls in serveral threads from the 
single volatile MemcachedClient instance. 

java.lang.StringIndexOutOfBoundsException String index out of range
java.lang.String.charAt(String.java:658)
java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
java.util.regex.Pattern$Curly.match0(Pattern.java:4148)
java.util.regex.Pattern$Curly.match(Pattern.java:4132)
java.util.regex.Pattern$Ques.match(Pattern.java:4079)
java.util.regex.Pattern$Begin.match(Pattern.java:3472)
java.util.regex.Matcher.match(Matcher.java:1221)
java.util.regex.Matcher.matches(Matcher.java:559)
net.spy.memcached.util.StringUtils.isJsonObject(StringUtils.java:113)
net.spy.memcached.transcoders.SerializingTranscoder.encode(SerializingTranscoder
.java:134)
net.spy.memcached.MemcachedClient.asyncStore(MemcachedClient.java:305)
net.spy.memcached.MemcachedClient.asyncStore(MemcachedClient.java:334)
net.spy.memcached.MemcachedClient.mutateWithDefault(MemcachedClient.java:1955)
net.spy.memcached.MemcachedClient.incr(MemcachedClient.java:1902)

The method net.spy.memcached.util.StringUtils.isJsonObject isn't thread safe, 
because it uses the single instance of java.util.regex.Matcher, which isn't 
thread safe.

Original issue reported on code.google.com by igorbun...@issart.com on 15 Dec 2014 at 11:59

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

1 participant