Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.11.0, 2.11.1, 2.11.2
    • Fix Version/s: 2.11.3
    • Component/s: None
    • Security Level: Public
    • Labels:
      None

      Description

      I found a multi-threading issue introduced in SPY-127. I added my comments already into this link but pasting it here as well.

      https://github.com/couchbase/spymemcached/commit/d8cd4e61226ce5f48f1aab8e94602f86defce36f#commitcomment-6452097

      -------

      The non-thread safe code has to do with "decimalMatcher.reset(s).matches()".

      When one thread is in the "matches", and then a second thread calls reset, I get a runtime exception..

      java.lang.StringIndexOutOfBoundsException: String index out of range: 4
      at java.lang.String.charAt(String.java:658)
      at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
      at java.util.regex.Pattern$Curly.match0(Pattern.java:4158)
      at java.util.regex.Pattern$Curly.match(Pattern.java:4132)
      at java.util.regex.Pattern$Ques.match(Pattern.java:4079)
      at java.util.regex.Pattern$Begin.match(Pattern.java:3472)
      at java.util.regex.Matcher.match(Matcher.java:1221)
      at java.util.regex.Matcher.matches(Matcher.java:559)
      at net.spy.memcached.util.StringUtils.isJsonObject(StringUtils.java:113)
      at net.spy.memcached.transcoders.SerializingTranscoder.encode(SerializingTranscoder.java:134)
      at net.spy.memcached.MemcachedClient.asyncStore(MemcachedClient.java:305)
      at net.spy.memcached.MemcachedClient.set(MemcachedClient.java:929)
      at com.couchbase.client.CouchbaseClient.set(CouchbaseClient.java:1266)
      at com.example.Test$1.run(Test.java:124)
      at java.lang.Thread.run(Thread.java:724)

      To reproduce, just create for example 10 threads that each loop 100K times calling set("anykey","123456789"). i.e. 1M set operations distributed between 10 threads.

      I encountered this because I have a very fast counter keeping track of my position in a set of objects.

        Attachments

        For Gerrit Dashboard: SPY-170
        # Subject Project Status CR V

          Activity

            People

            • Assignee:
              daschl Michael Nitschinger
              Reporter:
              nkavian Nas Kavian
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes