multithreading - Many threads are blocked and memory from old gen not releasing -


i using tomcat server , when took thread dump can see many threads blocked (172) , other threads in_native (27). many blocked threads smiler below. can 1 may reason. 8gb oldgen space full. after performing gc not releasing.

blocked threads :

    thread 22614 - threadid:thread 22614 - state:blocked stacktrace: - java.net.socketinputstream.socketread0(java.io.filedescriptor, byte[], int, int, int) @bci=0 (compiled frame; information may imprecise) - java.net.socketinputstream.read(byte[], int, int, int) @bci=87, line=152 (compiled frame) - java.net.socketinputstream.read(byte[], int, int) @bci=11, line=122 (compiled frame) - org.apache.coyote.http11.internalinputbuffer.fill(boolean) @bci=59, line=512 (compiled frame) - org.apache.coyote.http11.internalinputbuffer.fill() @bci=2, line=497 (compiled frame) - org.apache.coyote.http11.http11processor.process(org.apache.tomcat.util.net.socketwrapper) @bci=263, line=203 (compiled frame) - org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(org.apache.tomcat.util.net.socketwrapper, org.apache.tomcat.util.net.socketstatus) @bci=96, line=515 (compiled frame) - org.apache.tomcat.util.net.jioendpoint$socketprocessor.run() @bci=130, line=302 (compiled frame) - java.util.concurrent.threadpoolexecutor.runworker(java.util.concurrent.threadpoolexecutor$worker) @bci=95, line=1145 (compiled frame) - java.util.concurrent.threadpoolexecutor$worker.run() @bci=5, line=615 (interpreted frame) - java.lang.thread.run() @bci=11, line=745 (interpreted frame)     thread 23677 - threadid:thread 23677 - state:blocked stacktrace: - sun.misc.unsafe.park(boolean, long) @bci=0 (compiled frame; information may imprecise) - java.util.concurrent.locks.locksupport.parknanos(java.lang.object, long) @bci=20, line=226 (compiled frame) - java.util.concurrent.locks.abstractqueuedsynchronizer$conditionobject.awaitnanos(long) @bci=68, line=2082 (compiled frame) - java.util.concurrent.linkedblockingqueue.poll(long, java.util.concurrent.timeunit) @bci=62, line=467 (compiled frame) - org.apache.tomcat.util.threads.taskqueue.poll(long, java.util.concurrent.timeunit) @bci=3, line=86 (compiled frame) - org.apache.tomcat.util.threads.taskqueue.poll(long, java.util.concurrent.timeunit) @bci=3, line=32 (compiled frame) - java.util.concurrent.threadpoolexecutor.gettask() @bci=141, line=1068 (compiled frame) - java.util.concurrent.threadpoolexecutor.runworker(java.util.concurrent.threadpoolexecutor$worker) @bci=26, line=1130 (compiled frame) - java.util.concurrent.threadpoolexecutor$worker.run() @bci=5, line=615 (interpreted frame) - java.lang.thread.run() @bci=11, line=745 (interpreted frame)   thread 23674 - threadid:thread 23674 - state:blocked stacktrace: - com.mysql.jdbc.singlebytecharsetconverter.tostring(byte[], int, int) @bci=1, line=322 (compiled frame) - com.mysql.jdbc.resultsetrow.getstring(java.lang.string, com.mysql.jdbc.mysqlconnection, byte[], int, int) @bci=54, line=797 (compiled frame) - com.mysql.jdbc.bytearrayrow.getstring(int, java.lang.string, com.mysql.jdbc.mysqlconnection) @bci=24, line=72 (compiled frame) - com.mysql.jdbc.resultsetimpl.getstringinternal(int, boolean) @bci=155, line=5699 (compiled frame) - com.mysql.jdbc.resultsetimpl.getstring(int) @bci=3, line=5576 (compiled frame) - com.mysql.jdbc.resultsetimpl.getstring(java.lang.string) @bci=6, line=5616 (compiled frame) - com.mchange.v2.c3p0.impl.newproxyresultset.getstring(java.lang.string) @bci=19, line=3342 (compiled frame) - org.hibernate.type.stringtype.get(java.sql.resultset, java.lang.string) @bci=2, line=41 (compiled frame) - org.hibernate.type.nullabletype.nullsafeget(java.sql.resultset, java.lang.string) @bci=3, line=184 (compiled frame) - org.hibernate.type.nullabletype.nullsafeget(java.sql.resultset, java.lang.string, org.hibernate.engine.sessionimplementor, java.lang.object) @bci=3, line=210 (compiled frame) 

  • first stack trace indicates thread tried read socket , went blocked state. socket read operation blocking operation means if there nothing read or till information read, block.

  • for second, linkedblockingqueue.poll() not blocking operation normal stack trace indicate usual idle thread. not caused user code

  • for third, doesn't problematic string value result set returned.

i think, should @ this too.

stack trace # 1 , #3 might related socket read might db read.

these stack traces not solve problem these kind of blocked threads indicate problem memory , excessive garbage collection.

there might problem c3p0 pool or way might creating statement , result set objects - in seems case of memory leak , resources not closing well.

very precise answer not possible without relevant application code. also, stated in comment, identity of lock object needs dumped too.

hope helps !!


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -