major CPU spike on client side
I have a production application running JBoss application server 4.2.3 on Linux. The application uses Hibernate against MySQL server hosted on the same machine. On occasions, we experience a spike in CPU. Analyzing thread dump and process list, it seems that the issue is NOT on the database side but rather on the JVM. Thread dump indicates there are a some threads with high CPU usage on the following:
sun.nio.cs.UTF_8$Decoder.decodeArrayLoop(java.nio.ByteBuffer, java.nio.CharBuffer) @bci=67, line=188 (Interpreted frame)
- sun.nio.cs.UTF_8$Decoder.decodeLoop(java.nio.ByteBuffer, java.nio.CharBuffer) @bci=17, line=305 (Interpreted frame)
- java.nio.charset.CharsetDecoder.decode(java.nio.ByteBuffer, java.nio.CharBuffer, boolean) @bci=57, line=544 (Interpreted frame)
- java.nio.charset.CharsetDecoder.decode(java.nio.ByteBuffer) @bci=46, line=766 (Interpreted frame)
- java.nio.charset.Charset.decode(java.nio.ByteBuffer) @bci=17, line=771 (Interpreted frame)
- com.mysql.jdbc.StringUtils.toString(byte[], int, int, java.lang.String) @bci=14, line=2191 (Interpreted frame)
- com.mysql.jdbc.Field.getStringFromBytes(int, int) @bci=116, line=635 (Compiled frame)
- com.mysql.jdbc.Field.getOriginalName() @bci=33, line=574 (Compiled frame)
- com.mysql.jdbc.ResultSetImpl.buildIndexMapping() @bci=67, line=694 (Compiled frame)
- com.mysql.jdbc.ResultSetImpl.findColumn(java.lang.String) @bci=20, line=1038 (Compiled frame)
- com.mysql.jdbc.ResultSetImpl.getLong(java.lang.String) @bci=3, line=2748 (Compiled frame)
- org.jboss.resource.adapter.jdbc.WrappedResultSet.getLong(java.lang.String) @bci=9, line=724 (Compiled frame)
- org.hibernate.type.LongType.get(java.sql.ResultSet, java.lang.String) @bci=6, line=28 (Compiled frame)
- org.hibernate.type.NullableType.nullSafeGet(java.sql.ResultSet, java.lang.String) @bci=3, line=163 (Compiled frame)
Unfortunately, I haven't been able to locate the SQL statement which causes this at present.
We are using JDK 6.0 with MySQL driver version 5.1.35 on Linux Ubuntu distribution - Ubuntu 12.04.5 LTS (GNU/Linux 3.11.0-26-generic x86_64)
Has anyone ever experienced such an issue?