[jira] [Comment Edited] (FOP-2157) Deadlock in CompareUtil class

2016-01-07 Thread Peter Jodeleit (JIRA)

[ 
https://issues.apache.org/jira/browse/FOP-2157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15087481#comment-15087481
 ] 

Peter Jodeleit edited comment on FOP-2157 at 1/7/16 2:28 PM:
-

Sorry, I had still the revision id in the url, so in the list view the newest 
revision was hidden.

One minor issue with the code: "CompareUtil.equals(null, null)" always uses the 
'global' lock ("TIE_LOCK").


was (Author: jodeleit):
Sorry, I had still the revision in the url, so in the list view the newest 
revision was hidden.

One minor issue with the code: "CompareUtil.equals(null, null)" always uses the 
'global' lock ("TIE_LOCK").

> Deadlock in CompareUtil class
> -
>
> Key: FOP-2157
> URL: https://issues.apache.org/jira/browse/FOP-2157
> Project: FOP
>  Issue Type: Bug
>  Components: unqualified
>Affects Versions: trunk
> Environment: Operating System: All
> Platform: PC
>Reporter: Matthias Reischenbacher
>Assignee: Alexios Giotis
> Fix For: trunk
>
> Attachments: FOP DEADLOCK jakarta_service_20121107.log, 
> FOP-2157-test.patch, FOP-2157.patch, report-dump.txt, thread-dump.txt
>
>
> I'm getting a dead lock in the CompareUtil class, see the attached thread 
> dump. 
> Here small fragment of the thread dump
> [2012-11-07 14:06:25] [info] Found one Java-level deadlock:
> [2012-11-07 14:06:25] [info] =
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-58":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x06ca9480
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9bd00, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-5"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-5":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x116ecfc8
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9a000, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-18"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-18":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x06ca9480
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9bd00, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-5"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] Java stack information for the threads listed 
> above:
> [2012-11-07 14:06:25] [info] 
> ===
> [2012-11-07 14:06:25] [info] "http-80-exec-58":
> [2012-11-07 14:06:25] [info]  at java.util.Vector.equals(Vector.java:925)
> [2012-11-07 14:06:25] [info]  - waiting to lock <0x00071fe9bd00> 
> [2012-11-07 14:06:25] [info] (a java.util.Vector)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.util.CompareUtil.equal(CompareUtil.java:38)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.ListProperty.equals(ListProperty.java:123)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.PropertyCache.eq(PropertyCache.java:193)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:134)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.properties.FontFamilyProperty$Maker.make(FontFamilyProperty.java:94)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:413)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:321)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FObj.processNode(FObj.java:122)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:280)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xml.serializer.TreeWalker.startNode(TreeWalker.java:359)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xml.serializer.TreeWalker.traverse(TreeWalker.java:145)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:390)
> [2012-11-07 14:06:26] [info]  at 
> smc.fop.FopWrapper.transform(FopWrapper.java:150)
> [2012-11-07 14:06:26] [info]  at 
> smc.fop.FopWrapper.transform(FopWrapper.java:125)
> [2012-11-07 14:06:26] [info]  at smc.plugin.Dom2PDF.process(Dom2PDF.java:179)
> [2012-11-07 14:06:26] [info]  at 
> sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source)
> [2012-11-07 14:06:26] [info]  at 
> sun.reflect.D

[jira] [Comment Edited] (FOP-2157) Deadlock in CompareUtil class

2016-01-07 Thread Peter Jodeleit (JIRA)

[ 
https://issues.apache.org/jira/browse/FOP-2157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15087481#comment-15087481
 ] 

Peter Jodeleit edited comment on FOP-2157 at 1/7/16 2:28 PM:
-

Sorry, I had still the revision in the url, so in the list view the newest 
revision was hidden.

One minor issue with the code: "CompareUtil.equals(null, null)" always uses the 
'global' lock ("TIE_LOCK").


was (Author: jodeleit):
Sorry, I had still the revision in the url, so in the list view the newest 
revision was hidden.

One minor issue with the code: "CompareUtil.equals(null, null)" would always 
use the 'global' lock ("TIE_LOCK").

> Deadlock in CompareUtil class
> -
>
> Key: FOP-2157
> URL: https://issues.apache.org/jira/browse/FOP-2157
> Project: FOP
>  Issue Type: Bug
>  Components: unqualified
>Affects Versions: trunk
> Environment: Operating System: All
> Platform: PC
>Reporter: Matthias Reischenbacher
>Assignee: Alexios Giotis
> Fix For: trunk
>
> Attachments: FOP DEADLOCK jakarta_service_20121107.log, 
> FOP-2157-test.patch, FOP-2157.patch, report-dump.txt, thread-dump.txt
>
>
> I'm getting a dead lock in the CompareUtil class, see the attached thread 
> dump. 
> Here small fragment of the thread dump
> [2012-11-07 14:06:25] [info] Found one Java-level deadlock:
> [2012-11-07 14:06:25] [info] =
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-58":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x06ca9480
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9bd00, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-5"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-5":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x116ecfc8
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9a000, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-18"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-18":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x06ca9480
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9bd00, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-5"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] Java stack information for the threads listed 
> above:
> [2012-11-07 14:06:25] [info] 
> ===
> [2012-11-07 14:06:25] [info] "http-80-exec-58":
> [2012-11-07 14:06:25] [info]  at java.util.Vector.equals(Vector.java:925)
> [2012-11-07 14:06:25] [info]  - waiting to lock <0x00071fe9bd00> 
> [2012-11-07 14:06:25] [info] (a java.util.Vector)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.util.CompareUtil.equal(CompareUtil.java:38)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.ListProperty.equals(ListProperty.java:123)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.PropertyCache.eq(PropertyCache.java:193)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:134)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.properties.FontFamilyProperty$Maker.make(FontFamilyProperty.java:94)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:413)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:321)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FObj.processNode(FObj.java:122)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:280)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xml.serializer.TreeWalker.startNode(TreeWalker.java:359)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xml.serializer.TreeWalker.traverse(TreeWalker.java:145)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:390)
> [2012-11-07 14:06:26] [info]  at 
> smc.fop.FopWrapper.transform(FopWrapper.java:150)
> [2012-11-07 14:06:26] [info]  at 
> smc.fop.FopWrapper.transform(FopWrapper.java:125)
> [2012-11-07 14:06:26] [info]  at smc.plugin.Dom2PDF.process(Dom2PDF.java:179)
> [2012-11-07 14:06:26] [info]  at 
> sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source)
> [2012-11-07 14:06:26] [info]  at 
> sun.reflect

[jira] [Comment Edited] (FOP-2157) Deadlock in CompareUtil class

2016-01-07 Thread Peter Jodeleit (JIRA)

[ 
https://issues.apache.org/jira/browse/FOP-2157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15087393#comment-15087393
 ] 

Peter Jodeleit edited comment on FOP-2157 at 1/7/16 2:11 PM:
-

Hm, the linked revision has still the typo in it. And there is no newer 
revision. 

The patch is behaving correctly nevertheless, but it always uses the "global 
synchronized" branch. 
So the multithreaded performance with this patch should be really bad if the 
method is used often.

Without patch I get the deadlock really often (also from 
"CommonFont.equals(..)").


was (Author: jodeleit):
Hm, the linked revision has still the typo in it. And there is no newer 
revision. 

The patch is behaving correctly nevertheless, but it always uses the "global 
synchronized" branch. 
So the multithreaded performance with this patch should be really bad if the 
method is used often.

Without patch I'll get the deadlock really often (also from 
"CommonFont.equals(..)").

> Deadlock in CompareUtil class
> -
>
> Key: FOP-2157
> URL: https://issues.apache.org/jira/browse/FOP-2157
> Project: FOP
>  Issue Type: Bug
>  Components: unqualified
>Affects Versions: trunk
> Environment: Operating System: All
> Platform: PC
>Reporter: Matthias Reischenbacher
>Assignee: Alexios Giotis
> Fix For: trunk
>
> Attachments: FOP DEADLOCK jakarta_service_20121107.log, 
> FOP-2157-test.patch, FOP-2157.patch, report-dump.txt, thread-dump.txt
>
>
> I'm getting a dead lock in the CompareUtil class, see the attached thread 
> dump. 
> Here small fragment of the thread dump
> [2012-11-07 14:06:25] [info] Found one Java-level deadlock:
> [2012-11-07 14:06:25] [info] =
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-58":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x06ca9480
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9bd00, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-5"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-5":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x116ecfc8
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9a000, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-18"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-18":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x06ca9480
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9bd00, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-5"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] Java stack information for the threads listed 
> above:
> [2012-11-07 14:06:25] [info] 
> ===
> [2012-11-07 14:06:25] [info] "http-80-exec-58":
> [2012-11-07 14:06:25] [info]  at java.util.Vector.equals(Vector.java:925)
> [2012-11-07 14:06:25] [info]  - waiting to lock <0x00071fe9bd00> 
> [2012-11-07 14:06:25] [info] (a java.util.Vector)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.util.CompareUtil.equal(CompareUtil.java:38)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.ListProperty.equals(ListProperty.java:123)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.PropertyCache.eq(PropertyCache.java:193)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:134)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.properties.FontFamilyProperty$Maker.make(FontFamilyProperty.java:94)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:413)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:321)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FObj.processNode(FObj.java:122)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:280)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xml.serializer.TreeWalker.startNode(TreeWalker.java:359)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xml.serializer.TreeWalker.traverse(TreeWalker.java:145)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:390)
> [2012-11-07 14:06:26] [info]  at 
> smc.fop.FopWrapper.transform(FopWrapper.

[jira] [Comment Edited] (FOP-2157) Deadlock in CompareUtil class

2015-09-15 Thread Jens Schreiber (JIRA)

[ 
https://issues.apache.org/jira/browse/FOP-2157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14745558#comment-14745558
 ] 

Jens Schreiber edited comment on FOP-2157 at 9/15/15 2:52 PM:
--

Hi Luis,

why are you getting the o2Hash from the o1 object? Is this a typo? In that way 
you will always use locking.

Regards,
Jens

public static boolean equal(Object o1, Object o2) {
  int o1Hash = System.identityHashCode(o1);
  int o2Hash = System.identityHashCode(o1); // <- should "o2" be used here?


was (Author: oj34):
Hi Luis,

why are you getting the o2Hash from the o1 object? Is this a typo? In that way 
you will always use locking.

Regards,
Jens

public static boolean equal(Object o1, Object o2) {
  int o1Hash = System.identityHashCode(o1);
  int o2Hash = System.identityHashCode(o1);

> Deadlock in CompareUtil class
> -
>
> Key: FOP-2157
> URL: https://issues.apache.org/jira/browse/FOP-2157
> Project: FOP
>  Issue Type: Bug
>  Components: unqualified
>Affects Versions: trunk
> Environment: Operating System: All
> Platform: PC
>Reporter: Matthias Reischenbacher
>Assignee: Alexios Giotis
> Fix For: trunk
>
> Attachments: FOP DEADLOCK jakarta_service_20121107.log, 
> FOP-2157-test.patch, FOP-2157.patch, report-dump.txt, thread-dump.txt
>
>
> I'm getting a dead lock in the CompareUtil class, see the attached thread 
> dump. 
> Here small fragment of the thread dump
> [2012-11-07 14:06:25] [info] Found one Java-level deadlock:
> [2012-11-07 14:06:25] [info] =
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-58":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x06ca9480
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9bd00, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-5"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-5":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x116ecfc8
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9a000, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-18"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-18":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x06ca9480
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9bd00, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-5"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] Java stack information for the threads listed 
> above:
> [2012-11-07 14:06:25] [info] 
> ===
> [2012-11-07 14:06:25] [info] "http-80-exec-58":
> [2012-11-07 14:06:25] [info]  at java.util.Vector.equals(Vector.java:925)
> [2012-11-07 14:06:25] [info]  - waiting to lock <0x00071fe9bd00> 
> [2012-11-07 14:06:25] [info] (a java.util.Vector)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.util.CompareUtil.equal(CompareUtil.java:38)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.ListProperty.equals(ListProperty.java:123)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.PropertyCache.eq(PropertyCache.java:193)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:134)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.properties.FontFamilyProperty$Maker.make(FontFamilyProperty.java:94)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:413)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:321)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FObj.processNode(FObj.java:122)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:280)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xml.serializer.TreeWalker.startNode(TreeWalker.java:359)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xml.serializer.TreeWalker.traverse(TreeWalker.java:145)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:390)
> [2012-11-07 14:06:26] [info]  at 
> smc.fop.FopWrapper.transform(FopWrapper.java:150)
> [2012-11-07 14:06:26] [info]  at 
> smc.fop.FopWrapper.transform(FopWrapper.java:125)
> [2012-11-07 14:06:26] [info]  at smc.plugin.Dom2P

[jira] [Comment Edited] (FOP-2157) Deadlock in CompareUtil class

2014-12-18 Thread Jacques Le Roux (JIRA)

[ 
https://issues.apache.org/jira/browse/FOP-2157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14251430#comment-14251430
 ] 

Jacques Le Roux edited comment on FOP-2157 at 12/18/14 9:43 AM:


Hi, any chances for a new release? Why, as an OFBiz committer, can't I vote for?


was (Author: jacques.le.roux):
Hi, any chances for a new release?

> Deadlock in CompareUtil class
> -
>
> Key: FOP-2157
> URL: https://issues.apache.org/jira/browse/FOP-2157
> Project: Fop
>  Issue Type: Bug
>  Components: unqualified
>Affects Versions: trunk
> Environment: Operating System: All
> Platform: PC
>Reporter: Matthias Reischenbacher
>Assignee: Alexios Giotis
> Fix For: trunk
>
> Attachments: FOP DEADLOCK jakarta_service_20121107.log, 
> FOP-2157-test.patch, FOP-2157.patch, report-dump.txt, thread-dump.txt
>
>
> I'm getting a dead lock in the CompareUtil class, see the attached thread 
> dump. 
> Here small fragment of the thread dump
> [2012-11-07 14:06:25] [info] Found one Java-level deadlock:
> [2012-11-07 14:06:25] [info] =
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-58":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x06ca9480
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9bd00, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-5"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-5":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x116ecfc8
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9a000, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-18"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] "http-80-exec-18":
> [2012-11-07 14:06:25] [info]   waiting to lock monitor 0x06ca9480
> [2012-11-07 14:06:25] [info]  (object 0x00071fe9bd00, a java.util.Vector)
> [2012-11-07 14:06:25] [info] ,
>   which is held by "http-80-exec-5"
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] 
> [2012-11-07 14:06:25] [info] Java stack information for the threads listed 
> above:
> [2012-11-07 14:06:25] [info] 
> ===
> [2012-11-07 14:06:25] [info] "http-80-exec-58":
> [2012-11-07 14:06:25] [info]  at java.util.Vector.equals(Vector.java:925)
> [2012-11-07 14:06:25] [info]  - waiting to lock <0x00071fe9bd00> 
> [2012-11-07 14:06:25] [info] (a java.util.Vector)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.util.CompareUtil.equal(CompareUtil.java:38)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.ListProperty.equals(ListProperty.java:123)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.PropertyCache.eq(PropertyCache.java:193)
> [2012-11-07 14:06:25] [info]  at 
> org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:134)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.properties.FontFamilyProperty$Maker.make(FontFamilyProperty.java:94)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:413)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:321)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FObj.processNode(FObj.java:122)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:280)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xml.serializer.TreeWalker.startNode(TreeWalker.java:359)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xml.serializer.TreeWalker.traverse(TreeWalker.java:145)
> [2012-11-07 14:06:26] [info]  at 
> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:390)
> [2012-11-07 14:06:26] [info]  at 
> smc.fop.FopWrapper.transform(FopWrapper.java:150)
> [2012-11-07 14:06:26] [info]  at 
> smc.fop.FopWrapper.transform(FopWrapper.java:125)
> [2012-11-07 14:06:26] [info]  at smc.plugin.Dom2PDF.process(Dom2PDF.java:179)
> [2012-11-07 14:06:26] [info]  at 
> sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source)
> [2012-11-07 14:06:26] [info]  at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [2012-11-07 14:06:26] [info]  at 
> java.lang.reflect.Method.invoke(Method.java:597)
> [2012-11-07 14:06:26] [info]  at 
> smc.transform.core.dynacode.DynaCode$MyInvocationHandler.invoke(DynaCode.java:374)
> [2012

[jira] [Comment Edited] (FOP-2157) Deadlock in CompareUtil class

2013-07-19 Thread Johannes Herr (JIRA)

[ 
https://issues.apache.org/jira/browse/FOP-2157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13713586#comment-13713586
 ] 

Johannes Herr edited comment on FOP-2157 at 7/19/13 12:01 PM:
--

We have had the same problem in our test environment (see the attached 
thread-dump).

I have been able to reproduce the problem in the debugger. The following 
describes the result of my analysis.

As Gareth explained the deadlock happens when two Vectors V1 and V2 are 
compared with each other by two threads at the same time. Moreover the 
comparisons have the forms:

V1.equals(V2)
V2.equals(V1)

and not

V1.equals(V2)
V1.equals(V2)

This is important since otherwise there would be lock-ordering and no deadlock.

The Vectors in this case are contained in FontFamilyProperties which are 
contained in CommontFonts. (We know this, since line 240 in CommonFont appears 
in the traces, which does the comparison 'CompareUtil.equal(fontFamily, 
other.fontFamily)'.)

The comparison of the CommonFonts takes place in PropertyCache.fetch(..) in 
line 134:

if (eq(cached, obj)) {

The previously cached object is compared with the newly created one. To create 
the deadlock we need two threads that execute this line at the same time where 
for Thread A the 'cached' object contains V1 and the new 'obj' contains V2 and 
for Thread B the 'cached' object contains V2 and the new 'obj' contains V1 
(again because if the order was the same there would be no deadlock because of 
lock ordering).

So at first glance the problem seems easy to reproduce. It becomes tricky 
however because the PropertyCaches seem to ensure that there is always only one 
instance of a class (with equal values) in use. If that would be the case we 
would always compare the cached version (say V1) with new Version (V2, V3, V4), 
which cannot lead to this deadlock. Also when the WeakReference for V1 is 
cleared we would expect to compare V2 with V3, V4, ... and not somehow compare 
V2 with V1 at the same time that V1 is compared with V2.

The trick is line 151 in the PropertyCache:

map.put(hashCode, new WeakReference(obj));

This line is executed when there was an entry in the cache, but its reference 
has already been cleared by the GC.

Because of this line we can have 2 Threads A and B at this line, A with an 
object containing V1 and B with an object containing V2. A adds the element to 
the cache, while B waits for a while. A number of other threads pick up V1 from 
the cache, then Thread B adds V2 to the cache and other threads pick up V2 from 
the cache. In this way we have multiple threads with V1 and V2 running at the 
same time which can lead to the comparison that produces the deadlock.

That's the rough idea, now the steps to actually reproduce the problem in the 
debugger. You need an application which keeps running and repeatedly executes 
FOP with a number of threads. Between the runs the weak references to 
FontFamilyProperty and CommonFont need to be cleared, so don't keep any strong 
references to FOP around between the runs.

1. Trigger the generation
There will be an entry for the FontFamilyProperty in the cache.

2. (Maybe) run Garbage Collection (i.e. through JVisualVM)
This clears the WeakReference to the FontFamilyProperty, but keeps the 
WeakReference itself in the cache.

3. Place a breakpoint in line 151 of the PropertyCache and wait for 2 
FontFamilyProperties

map.put(hashCode, new WeakReference(obj));

Note that this line is only reached, when there is a cleared WeakReference in 
the cache.
(Unfortunately I had weired Eclipse error msgs, with conditional breakpoints 
here, so either use a conditional breakpoint or just wait till the breakpoint 
is hit by a FontFamilyProperty.)
I would suggest noting the object-ids of these FontFamilyProperties for later 
reference. (Btw these contain our vectors V1 and V2 that will later produce the 
deadlock.)

4. Place a breakpoint in line 119 of PropertyCache (to stop threads from 
putting a CommonFont in the cache).

5. Let one of the Threads with FontFamilyProperties in line 151 execute the put 
to place its object in the cache, while still keeping the other Thread stopped.

6. Wait for 2 Threads where obj instanceof CommonFont in line 119 (the 
breakpoint set in step 4): 

Integer hashCode = Integer.valueOf(obj.hashCode());

These will contain the FontFamilyProperty with V1, because it has been in the 
cache at this time.

7. Now place the second FontFamilyProperty in the cache.

8. Wait for 2 more Threads at line 119, which now hold a reference to a 
FontFamilyProperty with V2.

9. Let one of the V1 Threads at line 119 execute up to line 151, that is to the 
unconditional put of a CommonFont. (Again it is only possible to reach line 151 
if there is a cleared WeakReference in the cache, so you must put your 
breakpoints accordingly so that no other thread can fill the cache in the 
meantim