[jira] [Commented] (PDFBOX-3698) Static Initialization Deadlock between COSNumber/COSInteger

2018-02-13 Thread Joseph Smith (JIRA)

[ 
https://issues.apache.org/jira/browse/PDFBOX-3698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16362919#comment-16362919
 ] 

Joseph Smith commented on PDFBOX-3698:
--

Was the intention to fix this is 2.0.5?  Based on the comments I was thinking 
that the intention is this can only be fixed in 3.0.  If that is true then I 
think it is fine.  I was just requesting that the fixed version field remove 
2.0.5 so that it isn't misleading.

> Static Initialization Deadlock between COSNumber/COSInteger
> ---
>
> Key: PDFBOX-3698
> URL: https://issues.apache.org/jira/browse/PDFBOX-3698
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.3
> Environment: Mac OSX 10.12.3, Java(TM) SE Runtime Environment (build 
> 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
>Reporter: Sean Story
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.5, 3.0.0 PDFBox
>
>
> h3. Problem
> Using Tika 1.10 (PDF Box 1.8.10) to parse PDF documents in a multi-threaded 
> application, processing unexpectedly halted. Investigating the output of a 
> {{kill -3}}, we found:
> {noformat}
> "pool-2-thread-18" #50 prio=5 os_prio=0 tid=0x2af088a67000 nid=0xc9b9 in 
> Object.wait() [0x2af0dc803000]
>java.lang.Thread.State: RUNNABLE
>   at 
> org.apache.pdfbox.pdfparser.BaseParser.parseDirObject(BaseParser.java:1348)
> x 15
> "pool-2-thread-13" #45 prio=5 os_prio=0 tid=0x2af0cf910800 nid=0xc9b4 in 
> Object.wait() [0x2af0dc2ff000]
>java.lang.Thread.State: RUNNABLE
>   at org.apache.pdfbox.cos.COSDocument.getObjectFromPool(COSDocument.java:720)
>   at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:685)
> x 2
> "pool-2-thread-11" #43 prio=5 os_prio=0 tid=0x2af0cfba6000 nid=0xc9b2 in 
> Object.wait() [0x2af0dc0fc000]
>java.lang.Thread.State: RUNNABLE
>   at org.apache.pdfbox.cos.COSNumber.(COSNumber.java:33)
>   at 
> org.apache.pdfbox.pdfparser.BaseParser.parseDirObject(BaseParser.java:1348)
> x 1
> {noformat}
> Upon further investigation, it appears that there is a risk for deadlock when 
> BaseParser calls {{COSNumber.get()}} and COSDocument call 
> {{COSInteger.get()}}.
> I was able to semi-reliably replicate this issue with the below Spock test:
> {noformat}
> import org.apache.pdfbox.cos.COSInteger
> import org.apache.pdfbox.cos.COSNumber
> import spock.lang.Specification
> class ThreadingIssueSpec extends Specification{
> def "testy test"(){
> setup:
> Thread thread = new Thread(new Runnable(){
> @Override
> void run() {
> for (int i =0; i<100; i++){
> COSNumber.get("-")
> }
> }
> })
> thread.start()
> for(int i =0; i<100; i++) {
> COSInteger.get("-")
> }
> thread.join()
> expect:
> 1==1
> }
> }
> {noformat}
> (you'll likely need to run this several times before the test hangs, but it 
> does eventually hang)
> I updated my Tika dep to 1.14 (PDF Box 2.0.3) and was still able to replicate 
> this issue.



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

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



[jira] [Commented] (PDFBOX-3698) Static Initialization Deadlock between COSNumber/COSInteger

2018-02-13 Thread Joseph Smith (JIRA)

[ 
https://issues.apache.org/jira/browse/PDFBOX-3698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16362866#comment-16362866
 ] 

Joseph Smith commented on PDFBOX-3698:
--

[~tilman], the initial test using Spock is written in Groovy which internally 
uses Class.forName to initialize the class.  I have reproduced the issue 
starting with your Java code snippet by making the following change
{code:java}
public class PDFBox3698
{
public static void main(String[] args) throws ClassNotFoundException, 
InterruptedException
{
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
Class.forName(COSNumber.class.getName(), true, 
COSNumber.class.getClassLoader());
} catch (ClassNotFoundException ex) {
//
}
}
});
thread.start();
Class.forName(COSInteger.class.getName(), true, 
COSInteger.class.getClassLoader());
thread.join();
}
}
{code}
I was able to reproduce in 2.0.5 with a few executions.

I downloaded 3.0.0-SNAPSHOT 453 and ran the test against it and I can no longer 
reproduce the issue.

Would you mind removing 2.0.5 from the fix version list?  It tricked me into 
attempting that first which didn't work out.

> Static Initialization Deadlock between COSNumber/COSInteger
> ---
>
> Key: PDFBOX-3698
> URL: https://issues.apache.org/jira/browse/PDFBOX-3698
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.3
> Environment: Mac OSX 10.12.3, Java(TM) SE Runtime Environment (build 
> 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
>Reporter: Sean Story
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.5, 3.0.0 PDFBox
>
>
> h3. Problem
> Using Tika 1.10 (PDF Box 1.8.10) to parse PDF documents in a multi-threaded 
> application, processing unexpectedly halted. Investigating the output of a 
> {{kill -3}}, we found:
> {noformat}
> "pool-2-thread-18" #50 prio=5 os_prio=0 tid=0x2af088a67000 nid=0xc9b9 in 
> Object.wait() [0x2af0dc803000]
>java.lang.Thread.State: RUNNABLE
>   at 
> org.apache.pdfbox.pdfparser.BaseParser.parseDirObject(BaseParser.java:1348)
> x 15
> "pool-2-thread-13" #45 prio=5 os_prio=0 tid=0x2af0cf910800 nid=0xc9b4 in 
> Object.wait() [0x2af0dc2ff000]
>java.lang.Thread.State: RUNNABLE
>   at org.apache.pdfbox.cos.COSDocument.getObjectFromPool(COSDocument.java:720)
>   at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:685)
> x 2
> "pool-2-thread-11" #43 prio=5 os_prio=0 tid=0x2af0cfba6000 nid=0xc9b2 in 
> Object.wait() [0x2af0dc0fc000]
>java.lang.Thread.State: RUNNABLE
>   at org.apache.pdfbox.cos.COSNumber.(COSNumber.java:33)
>   at 
> org.apache.pdfbox.pdfparser.BaseParser.parseDirObject(BaseParser.java:1348)
> x 1
> {noformat}
> Upon further investigation, it appears that there is a risk for deadlock when 
> BaseParser calls {{COSNumber.get()}} and COSDocument call 
> {{COSInteger.get()}}.
> I was able to semi-reliably replicate this issue with the below Spock test:
> {noformat}
> import org.apache.pdfbox.cos.COSInteger
> import org.apache.pdfbox.cos.COSNumber
> import spock.lang.Specification
> class ThreadingIssueSpec extends Specification{
> def "testy test"(){
> setup:
> Thread thread = new Thread(new Runnable(){
> @Override
> void run() {
> for (int i =0; i<100; i++){
> COSNumber.get("-")
> }
> }
> })
> thread.start()
> for(int i =0; i<100; i++) {
> COSInteger.get("-")
> }
> thread.join()
> expect:
> 1==1
> }
> }
> {noformat}
> (you'll likely need to run this several times before the test hangs, but it 
> does eventually hang)
> I updated my Tika dep to 1.14 (PDF Box 2.0.3) and was still able to replicate 
> this issue.



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

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



[jira] [Commented] (PDFBOX-4109) Static Initialization Deadlock between COSNumber/COSInteger (2)

2018-02-26 Thread Joseph Smith (JIRA)

[ 
https://issues.apache.org/jira/browse/PDFBOX-4109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16377545#comment-16377545
 ] 

Joseph Smith commented on PDFBOX-4109:
--

A bit of both I suppose.  I was reviewing the code that produced the original 
issue which is in a production deployment.  I was exploring the benefit of 
updating versions in order to remove our work around for this issue and clean 
up the code a bit. 

Based on the original developers research the issue came down to this test 
which is in our code base.  I noticed that the issue could not be reproduced 
easily last time because the original test was written in Groovy.  I created a 
Java version which would reproduce the test just to help illustrate and 
reproduce the original issue.

Did something change about the initialization of PDDocument between 1.8.10 and 
2.0.8 that would have impact?

> Static Initialization Deadlock between COSNumber/COSInteger (2)
> ---
>
> Key: PDFBOX-4109
> URL: https://issues.apache.org/jira/browse/PDFBOX-4109
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.5, 2.0.8
>Reporter: Tilman Hausherr
>Priority: Major
>
> Written by [~jesmith3] in PDFBOX-3698:
> {code:java}
> public class PDFBox3698
> {
> public static void main(String[] args) throws ClassNotFoundException, 
> InterruptedException
> {
> Thread thread = new Thread(new Runnable() {
> @Override
> public void run() {
> try {
> Class.forName(COSNumber.class.getName(), true, 
> COSNumber.class.getClassLoader());
> } catch (ClassNotFoundException ex) {
> //
> }
> }
> });
> thread.start();
> Class.forName(COSInteger.class.getName(), true, 
> COSInteger.class.getClassLoader());
> thread.join();
> }
> }
> {code}
> I was able to reproduce in 2.0.5 with a few executions.
> I downloaded 3.0.0-SNAPSHOT 453 and ran the test against it and I can no 
> longer reproduce the issue.



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

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



[jira] [Commented] (PDFBOX-4109) Static Initialization Deadlock between COSNumber/COSInteger (2)

2018-02-27 Thread Joseph Smith (JIRA)

[ 
https://issues.apache.org/jira/browse/PDFBOX-4109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16378682#comment-16378682
 ] 

Joseph Smith commented on PDFBOX-4109:
--

Sounds fine to me.  When I get an opportunity I will try to test it against our 
real use case instead of this test.  Let you know if there are any issues but 
we use Tika which uses PDDocument so it sounds like there shouldn't be an 
issues.  Thanks.

> Static Initialization Deadlock between COSNumber/COSInteger (2)
> ---
>
> Key: PDFBOX-4109
> URL: https://issues.apache.org/jira/browse/PDFBOX-4109
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.5, 2.0.8
>Reporter: Tilman Hausherr
>Priority: Major
>
> Written by [~jesmith3] in PDFBOX-3698:
> {code:java}
> public class PDFBox3698
> {
> public static void main(String[] args) throws ClassNotFoundException, 
> InterruptedException
> {
> Thread thread = new Thread(new Runnable() {
> @Override
> public void run() {
> try {
> Class.forName(COSNumber.class.getName(), true, 
> COSNumber.class.getClassLoader());
> } catch (ClassNotFoundException ex) {
> //
> }
> }
> });
> thread.start();
> Class.forName(COSInteger.class.getName(), true, 
> COSInteger.class.getClassLoader());
> thread.join();
> }
> }
> {code}
> I was able to reproduce in 2.0.5 with a few executions.
> I downloaded 3.0.0-SNAPSHOT 453 and ran the test against it and I can no 
> longer reproduce the issue.



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

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