Search code examples
javajacksontomcat7deadlock

com.fasterxml.jackson.core.util.InternCache.intern() deadlock under high load


Env:

  • Amazon
  • Centos
  • Apache-tomcat-7.0.53
  • Java 8
  • Jackson-core-2.2.3

Problem

When we test our servers with a load of ~7000CCU, we see several of the following when we profile our appservers using Yourkit.

http-apr-8080-exec-952 <--- Frozen for at least 17 sec
com.fasterxml.jackson.core.util.InternCache.intern(String) InternCache.java:43
com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer.findSymbol(char[], int, int, int) CharsToNameCanonicalizer.java:506
com.fasterxml.jackson.core.json.ReaderBasedJsonParser._parseFieldName(int) ReaderBasedJsonParser.java:1182
com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken() ReaderBasedJsonParser.java:602
com.fasterxml.jackson.core.base.ParserMinimalBase.nextValue() ParserMinimalBase.java:128

What can we do to improve the performance of this library.


Solution

  • I found the reason, we were not closing the parser instance. By closing the parser instance in 'finally block' this issue has vanished.