pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnaud Jeansen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PDFBOX-4472) Thread stuck in SoftReferenceCache.get
Date Mon, 25 Feb 2019 16:17:00 GMT

     [ https://issues.apache.org/jira/browse/PDFBOX-4472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Arnaud Jeansen updated PDFBOX-4472:
-----------------------------------
    Description: 
We use pdfbox-jbig2 3.02 in a multi-threaded environment, and the SoftReferenceCache implementation
is a problem because of its usage of an unsynchronized WeakHashMap.

Today, we found two threads blocking each other with the same stack trace:
{code:java}
pool-95-thread-1 - priority:5 - threadId:0x00007f882c109800 - nativeId:0x3d81 - nativeId (decimal):15745
- state:RUNNABLE
stackTrace:
java.lang.Thread.State: RUNNABLE
at java.util.WeakHashMap.get(WeakHashMap.java:403)
at org.apache.pdfbox.jbig2.util.cache.SoftReferenceCache.get(SoftReferenceCache.java:40)
at org.apache.pdfbox.jbig2.JBIG2ImageReader.read(JBIG2ImageReader.java:243)
at javax.imageio.ImageReader.read(ImageReader.java:939)
at sun.reflect.GeneratedMethodAccessor3824.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.icepdf.core.pobjects.graphics.images.JBig2Decoder.decodeJbig2(JBig2Decoder.java:161)
at org.icepdf.core.pobjects.graphics.images.JBig2Decoder.decode(JBig2Decoder.java:80)
at org.icepdf.core.pobjects.graphics.images.ImageStream.getImage(ImageStream.java:94)
at org.icepdf.core.pobjects.graphics.images.references.ImageStreamReference.call(ImageStreamReference.java:74)
at org.icepdf.core.pobjects.graphics.images.references.ImageStreamReference.call(ImageStreamReference.java:40)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Locked ownable synchronizers:
- <0x0000000600019a48> (a java.util.concurrent.ThreadPoolExecutor$Worker)
{code}

I couldn't manage to write a unit test to reproduce the problem unfortunately. But the patch
is straightforward and attached to this ticket.


  was:
We use pdfbox-jbig2 3.02 in a multi-threaded environment, and the SoftReferenceCache implementation
is a problem because of its usage of an unsynchronized WeakHashMap.

Today, we found two threads blocking each other with the same stack trace:
{code:java}
pool-95-thread-1 - priority:5 - threadId:0x00007f882c109800 - nativeId:0x3d81 - nativeId (decimal):15745
- state:RUNNABLE
stackTrace:
java.lang.Thread.State: RUNNABLE
at java.util.WeakHashMap.get(WeakHashMap.java:403)
at org.apache.pdfbox.jbig2.util.cache.SoftReferenceCache.get(SoftReferenceCache.java:40)
at org.apache.pdfbox.jbig2.JBIG2ImageReader.read(JBIG2ImageReader.java:243)
at javax.imageio.ImageReader.read(ImageReader.java:939)
at sun.reflect.GeneratedMethodAccessor3824.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.icepdf.core.pobjects.graphics.images.JBig2Decoder.decodeJbig2(JBig2Decoder.java:161)
at org.icepdf.core.pobjects.graphics.images.JBig2Decoder.decode(JBig2Decoder.java:80)
at org.icepdf.core.pobjects.graphics.images.ImageStream.getImage(ImageStream.java:94)
at org.icepdf.core.pobjects.graphics.images.references.ImageStreamReference.call(ImageStreamReference.java:74)
at org.icepdf.core.pobjects.graphics.images.references.ImageStreamReference.call(ImageStreamReference.java:40)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Locked ownable synchronizers:
- <0x0000000600019a48> (a java.util.concurrent.ThreadPoolExecutor$Worker)
{code}

I couldn't manage to write a unit test to reproduce the problem unfortunately. But the patch
should be straightforward



> Thread stuck in SoftReferenceCache.get
> --------------------------------------
>
>                 Key: PDFBOX-4472
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4472
>             Project: PDFBox
>          Issue Type: Bug
>          Components: JBIG2
>    Affects Versions: 3.0.2 JBIG2
>            Reporter: Arnaud Jeansen
>            Priority: Major
>         Attachments: 0001-PDFBOX-4472-Enforce-access-to-the-weak-cache-through.patch
>
>
> We use pdfbox-jbig2 3.02 in a multi-threaded environment, and the SoftReferenceCache
implementation is a problem because of its usage of an unsynchronized WeakHashMap.
> Today, we found two threads blocking each other with the same stack trace:
> {code:java}
> pool-95-thread-1 - priority:5 - threadId:0x00007f882c109800 - nativeId:0x3d81 - nativeId
(decimal):15745 - state:RUNNABLE
> stackTrace:
> java.lang.Thread.State: RUNNABLE
> at java.util.WeakHashMap.get(WeakHashMap.java:403)
> at org.apache.pdfbox.jbig2.util.cache.SoftReferenceCache.get(SoftReferenceCache.java:40)
> at org.apache.pdfbox.jbig2.JBIG2ImageReader.read(JBIG2ImageReader.java:243)
> at javax.imageio.ImageReader.read(ImageReader.java:939)
> at sun.reflect.GeneratedMethodAccessor3824.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.icepdf.core.pobjects.graphics.images.JBig2Decoder.decodeJbig2(JBig2Decoder.java:161)
> at org.icepdf.core.pobjects.graphics.images.JBig2Decoder.decode(JBig2Decoder.java:80)
> at org.icepdf.core.pobjects.graphics.images.ImageStream.getImage(ImageStream.java:94)
> at org.icepdf.core.pobjects.graphics.images.references.ImageStreamReference.call(ImageStreamReference.java:74)
> at org.icepdf.core.pobjects.graphics.images.references.ImageStreamReference.call(ImageStreamReference.java:40)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> Locked ownable synchronizers:
> - <0x0000000600019a48> (a java.util.concurrent.ThreadPoolExecutor$Worker)
> {code}
> I couldn't manage to write a unit test to reproduce the problem unfortunately. But the
patch is straightforward and attached to this ticket.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Mime
View raw message