Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-1646

[PATCH] Deadlock in PropertyCache class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 0.95
    • None
    • unqualified
    • None
    • Operating System: Linux
      Platform: PC
    • 46962

    Description

      I have a multithreaded rendering application. Shortly after we had migrated to some nice smooth and very fast hardware, we started getting Java deadlocks in FOP code. Stack traces always looked like this one:

      "T4-CFD_MR accId=3065" prio=10 tid=0x00002aab37aa1400 nid=0x6123 waiting for monitor entry [0x000000004193e000..0x0000000041941ac0]
      java.lang.Thread.State: BLOCKED (on object monitor)
      at org.apache.fop.fo.properties.PropertyCache.get(PropertyCache.java:204)

      • waiting to lock <0x00002aaab388a3f8> (a org.apache.fop.fo.properties.PropertyCache$CacheSegment)
        at org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:283)
        at org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:301)
        at org.apache.fop.fo.properties.NumberProperty.getInstance(NumberProperty.java:120)
        at org.apache.fop.fo.expr.PropertyParser.parsePrimaryExpr(PropertyParser.java:262)
        at org.apache.fop.fo.expr.PropertyParser.parseUnaryExpr(PropertyParser.java:212)
        at org.apache.fop.fo.expr.PropertyParser.parseMultiplicativeExpr(PropertyParser.java:177)
        at org.apache.fop.fo.expr.PropertyParser.parseAdditiveExpr(PropertyParser.java:151)
        at org.apache.fop.fo.expr.PropertyParser.parseArgs(PropertyParser.java:378)
        at org.apache.fop.fo.expr.PropertyParser.parsePrimaryExpr(PropertyParser.java:343)
        at org.apache.fop.fo.expr.PropertyParser.parseUnaryExpr(PropertyParser.java:212)
        at org.apache.fop.fo.expr.PropertyParser.parseMultiplicativeExpr(PropertyParser.java:177)
        at org.apache.fop.fo.expr.PropertyParser.parseAdditiveExpr(PropertyParser.java:151)
        at org.apache.fop.fo.expr.PropertyParser.parseProperty(PropertyParser.java:125)

      ================================

      "T3-CFD_MR accId=3031" prio=10 tid=0x00002aab37a68800 nid=0x6122 waiting for monitor entry [0x000000004183c000..0x0000000041840c40]
      java.lang.Thread.State: BLOCKED (on object monitor)
      at org.apache.fop.fo.properties.PropertyCache.rehash(PropertyCache.java:226)

      • waiting to lock <0x00002aaab388a650> (a org.apache.fop.fo.properties.PropertyCache$CacheSegment)
        at org.apache.fop.fo.properties.PropertyCache.rehash(PropertyCache.java:228)
      • locked <0x00002aaab388b200> (a org.apache.fop.fo.properties.PropertyCache$CacheSegment)
        at org.apache.fop.fo.properties.PropertyCache.rehash(PropertyCache.java:228)
      • locked <0x00002aaab388b228> (a org.apache.fop.fo.properties.PropertyCache$CacheSegment)
        at org.apache.fop.fo.properties.PropertyCache.rehash(PropertyCache.java:228)
      • locked <0x00002aaab388b250> (a org.apache.fop.fo.properties.PropertyCache$CacheSegment)
        at org.apache.fop.fo.properties.PropertyCache.rehash(PropertyCache.java:228)
      • locked <0x00002aaab388b278> (a org.apache.fop.fo.properties.PropertyCache$CacheSegment)
        at org.apache.fop.fo.properties.PropertyCache.rehash(PropertyCache.java:228)
      • locked <0x00002aaab388b2a0> (a org.apache.fop.fo.properties.PropertyCache$CacheSegment)
        at org.apache.fop.fo.properties.PropertyCache.rehash(PropertyCache.java:228)
      • locked <0x00002aaab388b368> (a org.apache.fop.fo.properties.PropertyCache$CacheSegment)
        at org.apache.fop.fo.properties.PropertyCache.rehash(PropertyCache.java:228)

      ================================

      "T2-CFD_MR accId=2823" prio=10 tid=0x00002aab37a66c00 nid=0x6121 waiting for monitor entry [0x000000004173c000..0x000000004173fbc0]
      java.lang.Thread.State: BLOCKED (on object monitor)
      at org.apache.fop.fo.properties.PropertyCache.cleanSegment(PropertyCache.java:114)

      • waiting to lock <0x00002aaab38a33b8> (a [Z)
        at org.apache.fop.fo.properties.PropertyCache.put(PropertyCache.java:176)
      • locked <0x00002aaab388a650> (a org.apache.fop.fo.properties.PropertyCache$CacheSegment)
        at org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:287)
        at org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:301)
        at org.apache.fop.fo.properties.NumberProperty.getInstance(NumberProperty.java:120)
        at org.apache.fop.fo.expr.PropertyParser.parsePrimaryExpr(PropertyParser.java:262)
        at org.apache.fop.fo.expr.PropertyParser.parseUnaryExpr(PropertyParser.java:212)
        at org.apache.fop.fo.expr.PropertyParser.parseMultiplicativeExpr(PropertyParser.java:177)
        at org.apache.fop.fo.expr.PropertyParser.parseAdditiveExpr(PropertyParser.java:151)
        at org.apache.fop.fo.expr.PropertyParser.parseArgs(PropertyParser.java:378)
        at org.apache.fop.fo.expr.PropertyParser.parsePrimaryExpr(PropertyParser.java:343)
        at org.apache.fop.fo.expr.PropertyParser.parseUnaryExpr(PropertyParser.java:212)
        at org.apache.fop.fo.expr.PropertyParser.parseMultiplicativeExpr(PropertyParser.java:177)

      ================================

      "T1-CFD_MR accId=3070" prio=10 tid=0x00002aab37a5a000 nid=0x6120 waiting for monitor entry [0x000000004163c000..0x000000004163ed40]
      java.lang.Thread.State: BLOCKED (on object monitor)
      at org.apache.fop.fo.properties.PropertyCache.cleanSegment(PropertyCache.java:114)

      • waiting to lock <0x00002aaab38a33b8> (a [Z)
        at org.apache.fop.fo.properties.PropertyCache.put(PropertyCache.java:176)
      • locked <0x00002aaab388a330> (a org.apache.fop.fo.properties.PropertyCache$CacheSegment)
        at org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:287)
        at org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:301)
        at org.apache.fop.fo.properties.NumberProperty.getInstance(NumberProperty.java:109)
        at org.apache.fop.fo.expr.PropertyParser.parsePrimaryExpr(PropertyParser.java:258)
        at org.apache.fop.fo.expr.PropertyParser.parseUnaryExpr(PropertyParser.java:212)
        at org.apache.fop.fo.expr.PropertyParser.parseMultiplicativeExpr(PropertyParser.java:177)
        at org.apache.fop.fo.expr.PropertyParser.parseAdditiveExpr(PropertyParser.java:151)
        at org.apache.fop.fo.expr.PropertyParser.parseProperty(PropertyParser.java:125)
        at org.apache.fop.fo.expr.PropertyParser.parse(PropertyParser.java:91)
        at org.apache.fop.fo.properties.PropertyMaker.make(PropertyMaker.java:436)
        at org.apache.fop.fo.properties.CompoundPropertyMaker.make(CompoundPropertyMaker.java:207)

      ================================

      "T0-CFD_MR accId=2852" prio=10 tid=0x00002aab37a59800 nid=0x611f waiting for monitor entry [0x000000004153a000..0x000000004153dcc0]
      java.lang.Thread.State: BLOCKED (on object monitor)
      at org.apache.fop.fo.properties.PropertyCache.cleanSegment(PropertyCache.java:114)

      • waiting to lock <0x00002aaab38a33b8> (a [Z)
        at org.apache.fop.fo.properties.PropertyCache.put(PropertyCache.java:176)
      • locked <0x00002aaab388a3f8> (a org.apache.fop.fo.properties.PropertyCache$CacheSegment)
        at org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:287)
        at org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:301)
        at org.apache.fop.fo.properties.NumberProperty.getInstance(NumberProperty.java:120)
        at org.apache.fop.fo.expr.PropertyParser.parsePrimaryExpr(PropertyParser.java:262)
        at org.apache.fop.fo.expr.PropertyParser.parseUnaryExpr(PropertyParser.java:212)
        at org.apache.fop.fo.expr.PropertyParser.parseMultiplicativeExpr(PropertyParser.java:177)
        at org.apache.fop.fo.expr.PropertyParser.parseAdditiveExpr(PropertyParser.java:151)
        at org.apache.fop.fo.expr.PropertyParser.parseArgs(PropertyParser.java:378)
        at org.apache.fop.fo.expr.PropertyParser.parsePrimaryExpr(PropertyParser.java:343)
        at org.apache.fop.fo.expr.PropertyParser.parseUnaryExpr(PropertyParser.java:212)
        at org.apache.fop.fo.expr.PropertyParser.parseMultiplicativeExpr(PropertyParser.java:177)

      ================================
      END OF STACKS

      with some combination of get(), put(), cleanSegment() and rehash() methods.

      Can you provide any kind of workaround for this that can be done quickly ?? We are in production and suffer from these nasty deadlocks badly, since this application is mostly launched by schedule and we can't monitor it all the time. Is there something that can be done ??

      Attachments

        1. testCase.patch
          4 kB
          Alexios Giotis
        2. PropertyCache.patch
          3 kB
          Alexios Giotis
        3. PropertyCacheT.java
          8 kB
          Alexios Giotis
        4. PropertyCache.patch
          40 kB
          Alexios Giotis
        5. Bug46962-rev1167130-patch.txt
          62 kB
          Alexios Giotis
        6. propertycache.patch
          113 kB
          Mehdi Houshmand
        7. bz46962-jdk5-compatible.patch
          71 kB
          Alexios Giotis
        8. bz46962-rev1298724.patch
          70 kB
          Alexios Giotis

        Issue Links

          Activity

            People

              fop-dev@xmlgraphics.apache.org fop-dev
              rogov@devexperts.com ilj
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: