I have a thread dump of one of my processes. It has a bunch of these threads. I assume they store a bunch of memory, so I get OOM.
"Thread-8264" prio=6 tid=0x4c94ac00 nid=0xf3c runnable [0x4fe7f000]
java.lang.Thread.State: RUNNABLE
at java.util.zip.Inflater.inflateBytes(Native Method)
at java.util.zip.Inflater.inflate(Inflater.java:223)
- locked <0x0c9bc640> (a java.util.zip.Inflater)
at org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.java:235)
at com.my.ZipExtractorCommonsCompress.extract(ZipExtractorCommonsCompress.java:48)
at com.my.CustomThreadedExtractorWrapper$ExtractionThread.run(CustomThreadedExtractorWrapper.java:151)
Locked ownable synchronizers:
- None
"Thread-8241" prio=6 tid=0x4c94a400 nid=0xb8c runnable [0x4faef000]
java.lang.Thread.State: RUNNABLE
at java.util.zip.Inflater.inflateBytes(Native Method)
at java.util.zip.Inflater.inflate(Inflater.java:223)
- locked <0x0c36b808> (a java.util.zip.Inflater)
at org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.java:235)
at com.my.ZipExtractorCommonsCompress.extract(ZipExtractorCommonsCompress.java:48)
at com.my.CustomThreadedExtractorWrapper$ExtractionThread.run(CustomThreadedExtractorWrapper.java:151)
Locked ownable synchronizers:
- None
I am trying to figure out how this happened in this situation. CustomThreadedExtractorWrapper is a wrapper class that launches a thread to do some work (ExtractionThread, which uses ZipExtractorCommonsCompress to extract zip content from a compressed stream). If the task takes too much time, it is called to cancel the operation ExtractionThread.interrupt().
In my magazines, I see that the cancellation happened 25 times. And I see 21 of these streams in my landfill. My questions:
- What is the status of these threads? Alive and running? Blocked?
- They did not die with .interrupt (), apparently? Is there a surefire way to really kill a thread?
- "" ?
223 Inflater.java:
public synchronized int inflate(byte[] b, int off, int len) {
...
return inflateBytes(b, off, len);
}