1

I found high CPU usage in online environment, which is almost 2000% and the system load is very high. The following is jstack output (only post one thread):

"http-8090-125" daemon prio=10 tid=0x0000000013e42000 nid=0x273f runnable [0x00002aead133b000]
   java.lang.Thread.State: RUNNABLE
        at com.caucho.hessian.util.IdentityIntMap.get(IdentityIntMap.java:127)
        at com.caucho.hessian.io.Hessian2Output.addRef(Hessian2Output.java:1314)
        at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:141)
        at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
        at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:153)
        at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
        at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:153)
        at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
        at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:153)
        at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
        at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:153)
        at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
        at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:153)
        at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
        at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:153)

Also post the exception in tomcat log:

Aug 21, 2016 4:32:56 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet products_api threw exception
java.lang.StackOverflowError
    at com.caucho.hessian.util.IdentityIntMap.get(IdentityIntMap.java:114)
    at com.caucho.hessian.io.Hessian2Output.addRef(Hessian2Output.java:1314)
    at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:141)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
    at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:153)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
    at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:153)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
    at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:153)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
    at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:153)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
    at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:153)

I'm wondering if any special Java object type(Data or time?) that makes hessian goes into a Infinite loop, does anyone encountered such problem before? many thanks.

I'm using Oracle JDK 7 and Hession 3.1.5. This is the code in IdentityIntMap#get(Object key)

  public int get(Object key)
  {
    int mask = _mask;
    int hash = System.identityHashCode(key) % mask & mask;

    Object []keys = _keys;

    while (true) {
      Object mapKey = keys[hash];

      if (mapKey == null)
        return NULL;
      else if (mapKey == key)
        return _values[hash];

      hash = (hash + 1) % mask;
    }
  }
pfyuit
  • 83
  • 10
  • From a quick glance at the stack trace, and the related files of version 3.1.5, this *seems* to be a bug in this "Hessian" library: The `Hessian2Output#writeObject` method and the `JavaSerializer#writeObject` method are calling each other, alternatingly, without a stopping condition. If there are no compatibility issues, I'd suggest to try a newer version of the library, and hope that the bug is fixed there. – Marco13 Aug 21 '16 at 13:38
  • did it solve the problem with the newer version? – yuankui Jun 08 '17 at 15:05

0 Answers0